// ============================================================================ // 06 — THE VARIANCE THEOREM ("no wide conspiracy") // ============================================================================ // // GOAL. Prove, with an exact formula plus verifiable computation, that almost // all windows of length L = p_{n+1}^2 in the twin-slot pattern mod P = P_n# // contain at least one twin slot. This does not prove the Twin Prime // Conjecture (the ONE window we need — the frontier zone — could still be a // rare exception; that is the parity wall). It proves the conspiracy that // would kill the conjecture must be MEASURE-RARE: confined to a vanishing // fraction of all possible window positions. // // SETUP. A(r) = 1 if r is a twin slot mod P, i.e. for every prime p <= p_n: // r mod p is not in {0, p-2} (so that p divides neither r nor r+2) // For p = 2 the two forbidden classes coincide (0 = -2 mod 2), so only evens // are forbidden: twin slots are all odd. // // DENSITY (the Copying Theorem in density form): // delta = (1/2) * prod_{2 pn) break; const m = ((d % p) + p) % p; if (m === 0) prod *= (p - 2) / p; else if (m === 2 || m === p - 2) prod *= (p - 3) / p; else prod *= (p - 4) / p; } return prod; } function delta(pn){ let d = 0.5; for (const p of PRIMES){ if (p === 2) continue; if (p > pn) break; d *= (p - 2) / p; } return d; } // exact variance of the window count via the formula function varianceFormula(pn, L){ const del = delta(pn); let v = 0; for (let d = -(L - 1); d <= L - 1; d++) v += (L - Math.abs(d)) * (J(d, pn) - del * del); return v; } // --------------------------------------------------------------------------- // Part 1: brute-force verification at small levels // --------------------------------------------------------------------------- function bruteForce(pn, pNext){ const L = pNext * pNext; let P = 1; for (const p of PRIMES){ if (p > pn) break; P *= p; } // build the twin-slot indicator over one full period const A = new Uint8Array(P); A.fill(1); for (const p of PRIMES){ if (p > pn) break; for (const res of (p === 2 ? [0] : [0, p - 2])) for (let j = res; j < P; j += p) A[j] = 0; } // sliding window over the cyclic period: all P window positions let N = 0; for (let i = 0; i < L; i++) N += A[i % P]; let sum = 0, sumSq = 0, empty = 0; for (let t = 0; t < P; t++){ sum += N; sumSq += N * N; if (N === 0) empty++; N += A[(t + L) % P] - A[t]; // slide by one } const mean = sum / P, varBrute = sumSq / P - mean * mean; const varForm = varianceFormula(pn, L); console.log(`p=${pn} L=${L} mean=${mean.toFixed(4)} (formula ${(delta(pn)*L).toFixed(4)}) ` + `Var brute=${varBrute.toFixed(4)} Var formula=${varForm.toFixed(4)} match=${Math.abs(varBrute-varForm)<1e-6} ` + `empty windows=${empty}/${P}`); } console.log('--- Part 1: formula vs brute force (all window positions scanned) ---'); bruteForce(13, 17); bruteForce(17, 19); // --------------------------------------------------------------------------- // Part 2: formula-only evaluation — the Chebyshev bound per level // --------------------------------------------------------------------------- console.log('\n--- Part 2: Chebyshev bound on the fraction of EMPTY length-p_next^2 windows ---'); const LEVELS = [13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 61, 71, 83, 97]; for (const pn of LEVELS){ const pNext = PRIMES[PRIMES.indexOf(pn) + 1]; const L = pNext * pNext; const EN = delta(pn) * L; const V = varianceFormula(pn, L); console.log(`p=${pn} L=${L} E[N]=${EN.toFixed(1)} Var=${V.toFixed(1)} Var/E[N]=${(V/EN).toFixed(3)} ` + `empty fraction <= ${(V/(EN*EN)).toExponential(2)}`); } // ============================================================================ // OUTPUT — EMBEDDED, do not hand-edit. Regenerate: // node research/qc/embed.js research/06-variance-theorem.js // invocation: node research/06-variance-theorem.js // code-sha256: b57379ab0924518e1f97e0626b43ba05c02194e9472aa53554e745b5f7251014 // out-sha256: b3e12722cd1c5d1d89a1e1780432ca5408cf180988dbcd2efc88e4d504f4d780 // node: v22.21.0 // embedded: 2026-08-18 // elapsed: 0.1 s // ============================================================================ // --- Part 1: formula vs brute force (all window positions scanned) --- // p=13 L=289 mean=14.2912 (formula 14.2912) Var brute=2.3596 Var formula=2.3596 match=true empty windows=0/30030 // p=17 L=361 mean=15.7515 (formula 15.7515) Var brute=2.8416 Var formula=2.8416 match=true empty windows=0/510510 // // --- Part 2: Chebyshev bound on the fraction of EMPTY length-p_next^2 windows --- // p=13 L=289 E[N]=14.3 Var=2.4 Var/E[N]=0.165 empty fraction <= 1.16e-2 // p=17 L=361 E[N]=15.8 Var=2.8 Var/E[N]=0.180 empty fraction <= 1.15e-2 // p=19 L=529 E[N]=20.7 Var=4.0 Var/E[N]=0.191 empty fraction <= 9.27e-3 // p=23 L=841 E[N]=30.0 Var=5.2 Var/E[N]=0.174 empty fraction <= 5.79e-3 // p=29 L=961 E[N]=31.9 Var=6.5 Var/E[N]=0.205 empty fraction <= 6.41e-3 // p=31 L=1369 E[N]=42.5 Var=8.0 Var/E[N]=0.189 empty fraction <= 4.45e-3 // p=37 L=1681 E[N]=49.4 Var=9.6 Var/E[N]=0.194 empty fraction <= 3.93e-3 // p=41 L=1849 E[N]=51.7 Var=10.7 Var/E[N]=0.207 empty fraction <= 4.01e-3 // p=47 L=2809 E[N]=71.6 Var=16.0 Var/E[N]=0.223 empty fraction <= 3.11e-3 // p=53 L=3481 E[N]=85.4 Var=19.1 Var/E[N]=0.223 empty fraction <= 2.61e-3 // p=61 L=4489 E[N]=102.9 Var=23.7 Var/E[N]=0.230 empty fraction <= 2.23e-3 // p=71 L=5329 E[N]=115.2 Var=28.3 Var/E[N]=0.246 empty fraction <= 2.13e-3 // p=83 L=7921 E[N]=158.4 Var=39.0 Var/E[N]=0.246 empty fraction <= 1.56e-3 // p=97 L=10201 E[N]=195.3 Var=48.1 Var/E[N]=0.246 empty fraction <= 1.26e-3 // READINGS. // 1. The exact formula matches brute force to 1e-6 at both fully-scanned // levels, and NO empty window exists at those levels at all. // 2. THE HEADLINE: Var/E[N] ~ 0.17-0.25. A Poisson-random pattern would give // exactly 1.0. The twin-slot moiré is 4-5x MORE UNIFORM THAN RANDOM — // the negative correlations of the sieve (rho_p(d) = p-4 < p-2 for generic // d) actively suppress clumping. Provably sub-Poisson. // 3. The Chebyshev bound on the empty-window fraction FALLS with the level // (1.2e-2 -> 1.3e-3 by p=97), tracking ~ Var/E[N]^2 ~ ln^2(p)/p^2 -> 0. // THEOREM (verifiable computation, per level): at least 99.87% of all // length-p_next^2 windows mod P_97# contain a twin slot. The conspiracy // that would starve the frontier zone is measure-rare, and gets rarer. // 4. What this does NOT prove: that THE zone (the one starting at p_n) is not // one of the rare exceptions. That final step is the parity wall. // ============================================================================ // --------------------------------------------------------------------------- // FIGURE PROVENANCE (added 2026-08-20, readings-traceability pass). What every // figure in the readings above that the embedded run of this file does not // contain verbatim actually is. No number above was changed. // // ROUNDINGS of a value this file's own run prints (printed value first): // 1.16e-2 at p=13 -> "1.2e-2" and 1.26e-3 at p=97 -> "1.3e-3" in reading 3, // the first and last rows of the printed empty-fraction column. // // DERIVED IN THIS READING by arithmetic over printed values: // 99.87 in reading 3 is the complement of the p=97 Chebyshev bound: // 1 - 1.26e-3 = 0.99874, quoted as "at least 99.87% of all windows". // // TOKENIZER ARTIFACT, not a figure: // -0.25 in reading 2 is the tail of the range "0.17-0.25". Both ends are // roundings of the printed Var/E[N] column, whose minimum is 0.165 at p=13 // and whose maximum is 0.246 at p=71, 83 and 97. // ---------------------------------------------------------------------------