#!/usr/bin/env python3 """Exact window kernel of the Var/E identification step, and the fixed-modulus obstruction to its printed prefix hypothesis. Written in job #4472 (explore, lane dir-558, question `Q-varE-identification-0830`) as the exact-arithmetic half of an independent re-check of the served record. Nothing here is a proof about twin primes; every statement is an exact identity or a finite evaluation. Objects (all from the served record, project-relative paths only) ----------------------------------------------------------------- `research/history/staging/varE-theta2-proof.md` sec.1: for the diagonal window half-length `L`, a modulus `n` and a class `c` mod `n`, S_n(c) = sum_{|h| < L, h = c (mod n)} (1 - |h|/L), R_n(c) = S_n(c) - L/n, and the record's closed form (PROVEN there, checked on 4000 random triples) is R_n(c) = [ (r - c)^+ + (r + c - n)^+ - r^2/n ] / L, r = L mod n. `research/history/staging/attack-0830-varE-identification.md` sec.3: the CRT class of a mixed lag with parts (n0, n+, n-) is the Kloosterman fraction `c/n = 2( inv(n0 n-, n+)/n+ - inv(n0 n+, n-)/n- ) mod 1`, equivalently `c = 2 n0 v` with `v = inv(n0) (mod n+)`, `v = -inv(n0) (mod n-)`. `research/history/staging/recon-0830-smooth-aps.md` sec.3.1a: the fixed-modulus obstruction that REFUTES the printed prefix hypothesis `(H_w)`. With `chi = (./7)` and `a(n) = mu^2(n) 1_(n,30)=1 prod_{p|n} p/(p-4) / n`, C_chi = sum_n a(n) chi(n) = L(1,chi) * (4/5) * prod_{p>=11} (1 + (4 chi(p) - 1)/(p(p-4))) and the record proves `C_chi >= (21/20)(4/5)(809/2016) = 809/2400 > 1/3`. `c_chi_*` below re-derives both forms. `research/history/staging/attack-0830-varE-identification.js` PART A/B/F are re-checked here in exact arithmetic. """ from fractions import Fraction __all__ = [ "rn", "shift_sum", "class_sum", "kernel_bound_holds", "rn_large_modulus", "kloosterman_class", "crt", "chi7", "l_one_chi7", "block_first_value", "c_chi_product", "c_chi_euler_factor_form", "C_CHI_LOWER_BOUND", "harper_range_holds", ] C_CHI_LOWER_BOUND = Fraction(809, 2400) # recon-0830-smooth-aps.md sec.3.1a # -------------------------------------------------------------------------- # the Fejer window kernel # -------------------------------------------------------------------------- def rn(L, n, c): """The record's closed form for R_n(c), exact (Fraction).""" r = L % n return Fraction(max(0, r - c) + max(0, r + c - n), L) - Fraction(r * r, n * L) def shift_sum(L, n, c): """Brute-force S_n(c) = sum_{|h| -L: tot += Fraction(L - abs(h), L) h -= n return tot def class_sum(L, n): """sum_{c mod n} R_n(c), exact.""" return sum((rn(L, n, c) for c in range(n)), Fraction(0)) def kernel_bound_holds(L, n, c): """|R_n(c)| <= min(1, n/L), exact.""" return abs(rn(L, n, c)) <= min(Fraction(1), Fraction(n, L)) def rn_large_modulus(L, n, c): """For n > 2L: R_n(c) = (L - ||c||_n)^+ / L - L/n, exact.""" c %= n d = min(c, n - c) return Fraction(max(0, L - d), L) - Fraction(L, n) # -------------------------------------------------------------------------- # the mixed lag's CRT class # -------------------------------------------------------------------------- def crt(residues, moduli): """Solve x = r_i (mod m_i) for pairwise coprime m_i. Returns (x mod M, M).""" M = 1 for m in moduli: M *= m x = 0 for r, m in zip(residues, moduli): Mi = M // m x = (x + r * Mi * pow(Mi, -1, m)) % M return x, M def kloosterman_class(n0, np_, nm): """(c, n, fraction check, root check) for the triple (n0, n+, n-). Returns the CRT class c mod n = n0 n+ n- with c = 0 (n0), 2 (n+), -2 (n-), the fraction-form value `2 n0 n- a - 2 n0 n+ b mod n` with a = inv(n0 n-, n+), b = inv(n0 n+, n-) (this is `c = 2n( a/n+ - b/n- )`, the Kloosterman fraction of the record's PART A), and the root-form value `2 n0 v` with v = inv(n0) (n+), v = -inv(n0) (n-). """ n = n0 * np_ * nm c, _ = crt([0, 2, -2], [n0, np_, nm]) a = pow(n0 * nm % np_, -1, np_) b = pow(n0 * np_ % nm, -1, nm) frac = (2 * n0 * nm * a - 2 * n0 * np_ * b) % n v, m = crt([pow(n0, -1, np_), -pow(n0, -1, nm)], [np_, nm]) root = (2 * n0 * v) % n return c, n, frac, root, v, m # -------------------------------------------------------------------------- # the chi = (./7) obstruction of recon-0830-smooth-aps.md sec.3.1a # -------------------------------------------------------------------------- def chi7(n): """The Legendre symbol (n/7), 0 for n = 0 mod 7.""" n %= 7 if n == 0: return 0 return 1 if n in (1, 2, 4) else -1 def l_one_chi7(blocks): """Partial sum of sum_{m>=1} chi(m)/m over the first `blocks` blocks of 7. Block j contributes sum_{r=1}^{7} chi(r)/(7j+r) (chi(7)=0). Returns the exact Fraction total; the record's claim is that every block is positive and the first equals 21/20. """ tot = Fraction(0) for j in range(blocks): for r in range(1, 7): tot += Fraction(chi7(r), 7 * j + r) return tot def block_first_value(): """The first block, exact: 1 + 1/2 - 1/3 + 1/4 - 1/5 - 1/6.""" return sum((Fraction(chi7(r), r) for r in range(1, 7)), Fraction(0)) def block_values(blocks): """Every block's exact value; the record claims all are > 0.""" return [sum((Fraction(chi7(r), 7 * j + r) for r in range(1, 7)), Fraction(0)) for j in range(blocks)] def c_chi_product(primes, terms=1.0): """prod_{p not in {2,3,5}} (1 + chi(p)/(p-4)), float, over the given primes. This is the Dirichlet series of `a` at s = 1 (chi(7) = 0 kills the p = 7 factor). `terms` is unused; kept for signature symmetry. """ v = 1.0 for p in primes: if p in (2, 3, 5): continue v *= 1.0 + chi7(p) / (p - 4) return v def c_chi_euler_factor_form(l_one, primes): """L(1,chi) * (4/5) * prod_{p>=11}(1 + (4 chi(p) - 1)/(p(p-4))).""" v = l_one * 0.8 for p in primes: if p <= 7: continue v *= 1.0 + (4 * chi7(p) - 1) / (p * (p - 4)) return v def harper_range_holds(x, Q): """The range hypothesis of Harper arXiv:2412.19644v1 Theorem 1.""" import math return math.sqrt(2.0 * x) < Q <= x