#!/usr/bin/env python3 """Verify return #893's obstruction claims against return #892 (route 61). Pure arithmetic. Confirms: (a) S_p(n) = sum_{a=0}^{p-1} exp(2 pi i a n / p) = p * 1_{p|n}, c_p(n) = S_p(n) - 1 (Ramanujan sum), so the cosine and correctly-normalised Dirichlet kernels are the SAME exact indicator: (p-1-c_p)/p = 1 - S_p/p = 1_{p∤n}. (b) kernel_study.py's "Dirichlet" alternative used (p-1-S_p)/p, which is NOT 1_{p∤n} (it is (p-1)/p when p∤n and -1/p when p|n), so the reported "+9.63 vs +4.50" compares the exact sieve against a mismatched weight. (c) structural: any finite-integer-gauge, n-independent-coefficient kernel is a function of n mod L = lcm(g), hence cannot distinguish twin primes from rough composites that survive the same sieving primes (they share residues mod P#); both score exactly 1 under the binary twin sieve I_z. """ import json from math import cos, pi, gcd from fractions import Fraction def S_p(n, p): return p if n % p == 0 else 0 def c_p(n, p): return (p - 1) if n % p == 0 else -1 def main(): primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] # (a) S_p = c_p + 1 = p * 1_{p|n}, for all residues a_ok = True for p in primes: for n in range(p): if not (S_p(n, p) == c_p(n, p) + 1): a_ok = False # and both kernels give the exact indicator b_ok = True for p in primes: for n in range(p): ramanujan = Fraction(p - 1 - c_p(n, p), p) dirichlet_correct = 1 - Fraction(S_p(n, p), p) indicator = 0 if n % p == 0 else 1 if not (ramanujan == dirichlet_correct == indicator): b_ok = False # (b) the mismatched weight used in kernel_study.py mismatch = {} for p in (5, 7): vals = {} for n in range(p): w = Fraction(p - 1 - S_p(n, p), p) vals[str(n)] = str(w) mismatch[str(p)] = vals # (c) structural: binary twin sieve I_z is identically 1 on twins AND on # rough composites below the square root of the smaller of (n, n+2) P = 2 * 3 * 5 * 7 * 11 * 13 # P(13)#, z=13 # twin primes and rough composites (n composite, gcd(n(n+2), P)=1) both score 1 def I_z(n, z_primes): return all(gcd(n, p) != 1 or gcd(n + 2, p) != 1 or (gcd(n, p) == 1 and gcd(n + 2, p) == 1) for p in z_primes) # placeholder, replaced below # cleaner: I_z(n) = 1 iff for all p<=z: p∤n and p∤n+2 def I_z2(n, z_primes): for p in z_primes: if n % p == 0 or (n + 2) % p == 0: return 0 return 1 z_primes = [2, 3, 5, 7, 11, 13] twins = [n for n in range(3, 100) if all(n % p != 0 for p in range(2, int(n**0.5)+1)) and all((n+2) % p != 0 for p in range(2, int((n+2)**0.5)+1))] rough_composites = [n for n in range(20, 200) if I_z2(n, z_primes) == 1 and not (all(n % p != 0 for p in range(2, int(n**0.5)+1)) and all((n+2) % p != 0 for p in range(2, int((n+2)**0.5)+1)))] twin_scores = [I_z2(n, z_primes) for n in twins] rough_scores = [I_z2(n, z_primes) for n in rough_composites] out = { "claim_a": "S_p = c_p + 1 = p*1_{p|n}, and (p-1-c_p)/p = 1-S_p/p = 1_{p∤n} for all residues", "a_verified": a_ok and b_ok, "claim_b": "kernel_study.py used (p-1-S_p)/p as the 'Dirichlet' alternative, not 1-S_p/p", "mismatched_dirichlet_weight": mismatch, "claim_c": "the binary twin sieve I_z gives score 1 to BOTH twin primes and rough composites (below their sqrt), so no finite-z kernel separates them", "twin_scores_at_z13": twin_scores[:20], "rough_composite_scores_at_z13": rough_scores[:20], "structural": "any kernel sum_q a_q e^{2 pi i n/q} over finite integer gauges q is a function of n mod lcm(q); twins and rough composites agree mod P(z)# (both are rough survivors), so no such kernel separates them.", } with open("outputs/route61_obstruction_verify.json", "w") as f: json.dump(out, f, indent=2) print(json.dumps({k: v for k, v in out.items() if k in ("a_verified", "claim_a", "claim_b")}, indent=2)) print("mismatched Dirichlet weight (p=5):", out["mismatched_dirichlet_weight"]["5"]) print("twin I_z scores (z=13):", out["twin_scores_at_z13"]) print("rough-composite I_z scores (z=13):", out["rough_composite_scores_at_z13"]) print("wrote outputs/route61_obstruction_verify.json") if __name__ == "__main__": main()