"""Small, deterministic checks of disputed statements in return 41. Run from the directory containing this file: python3 review-check.py. Inputs are the return's captured table, its twelve files, and elementary definitions. No large producer is run; no third-party packages are needed. """ from pathlib import Path from math import exp, log, prod, sqrt, isqrt import hashlib import json root = Path(__file__).resolve().parent record = json.loads((root / "return-41.json").read_text(encoding="utf-8")) for f in record["files"]: data = (root / f["name"]).read_bytes() assert len(data) == f["bytes"] assert hashlib.sha256(data).hexdigest() == f["sha256"] print("All 12 return files match recorded sizes and SHA-256 hashes.") def primes(n): sieve = bytearray([1]) * (n + 1) sieve[:2] = b"\x00\x00" for p in range(2, isqrt(n) + 1): if sieve[p]: sieve[p*p::p] = b"\x00" * len(range(p*p, n+1, p)) return [p for p in range(2, n+1) if sieve[p]] # The reflection is in the scour-prime phase space, not modulo W. x, W, q = 11, 2310, 13 small = primes(isqrt(W)) comb = {r for r in range(W) if r % 30 in (11, 17) and all(r % p not in (0, p-2) for p in small if 7 <= p <= x)} mu = lambda r: W-2-r assert {mu(r) for r in comb} == comb pair = lambda t: {t % q, (t-2) % q} reflected = lambda t: {(W-2-c) % q for c in pair(t)} print(f"Mirror example: x={x}, W={W}, q={q}, |comb|={len(comb)}") for t in [0, W//2]: print(f" t={t}: strike pair={sorted(pair(t))}; reflected={sorted(reflected(t))}; fixed={pair(t)==reflected(t)}") witness = min(r for r in comb if r % q in pair(0) and mu(r) % q not in pair(0)) print(f" r={witness} is struck at t=0; mu(r)={mu(witness)} is not; residues {witness%q} and {mu(witness)%q} modulo 13.") scour = [p for p in small if p > x] def count(t): return sum(all(r % p not in (t % p, (t-2) % p) for p in scour) for r in comb) nonperiod = next(t for t in range(W) if count(t) != count(W+t)) print(f" S(0)={count(0)}, S(W)={count(W)}, S({nonperiod})={count(nonperiod)}, S(W+{nonperiod})={count(W+nonperiod)}") print(" Equality at reflected endpoints does not make the phase family W-periodic.") for width in [2310, 30030]: print(f"Cardinality proof threshold W={width}: sqrt(W)/4={sqrt(width)/4:.8f}; 2*log(W)={2*log(width):.8f}; claimed inequality={sqrt(width)/4>2*log(width)}") levels = [7, 11, 13, 17, 19, 23, 29, 31, 37, 41] survivors = [8, 45, 307, 3099, 38380, 597475, 12307838, 283449187, 7998394865, 256725962834] # Captured E values in the submitted manuscript; their precision is enough # to decide the claimed four-decimal regression intercepts. means = [6.923076923076923, 39.27357309932759, 304.282383765545, 3245.506, 41441.19, 669028.8, 14063617.4, 328601798.6, 9377228928.8, 303627067641.7] # Replace the six cheap means by exact rational products from definitions. from fractions import Fraction for i, x in enumerate(levels[:6]): width = prod(primes(x)) density = Fraction(2, 30) for p in primes(isqrt(width)): if p >= 7: density *= Fraction(p-2, p) means[i] = float(width*density) gamma = 0.5772156649015328606 constant = exp(2*gamma)/4 us, betas, residuals = [], [], [] print(f"exp(2*gamma)/4={constant:.12f}") for x, s, e in zip(levels, survivors, means): width = prod(primes(x)) u, beta = 1/log(width), s/e residual = beta-constant*(1+2*u+6*u*u) us.append(u); betas.append(beta); residuals.append(residual) print(f"x={x}: beta={beta:.9f}; classical residual={residual:+.9f}") def fit(xx, yy): mx, my = sum(xx)/len(xx), sum(yy)/len(yy) slope = sum((x-mx)*(y-my) for x,y in zip(xx,yy))/sum((x-mx)**2 for x in xx) intercept = my-slope*mx rms = sqrt(sum((y-intercept-slope*x)**2 for x,y in zip(xx,yy))/len(xx)) return intercept, rms for label, lo in [("last four",6),("all ten",0)]: a, rms = fit(us[lo:], betas[lo:]) print(f"OLS beta on 1/log(W), {label}: intercept={a:.9f}, rms={rms:.9f}") print(f"Deepest gap/residual ratio={(betas[-1]-constant)/residuals[-1]:.6f}") print(f"Sum of survivors at six independently checked levels={sum(survivors[:6])}") # Effective lower bound from RS Theorem 7, equation (3.27), y >= 13. # C2 >= product over ALL integers n>=2 of (1-1/n^2) = 1/2. cprime = (8/3)*exp(-2*gamma)*(1-1/log(13)**2)**2 print(f"Explicit universal E lower-bound coefficient c'={cprime:.9f}; hence E > 0.60 W/log(W)^2 for x>=7.")