#!/usr/bin/env python3 """Independent read/derive/verify checks for route-70 re-review (job #2596). Deterministic, stdlib-only, ~0 cpu. Re-derives the numerics the revision cites and exhibits the LV/LVP-superset counterexample. Nothing here is a proof of any twin-prime statement. """ from fractions import Fraction def main(): # 1. theta-instance factor 3p/theta -> 3/2 for p in [7, 11, 13, 227]: eta = +1 if p % 6 == 1 else -1 theta = 2 * p - 2 * eta r = Fraction(3 * p, theta) assert r in (Fraction(7, 4), Fraction(11, 8), Fraction(13, 8), Fraction(227, 152)) # 2. pair-at-6p identity: 2T = S + (g1 + g_{m+1}) >= 6pm => T >= 3pm for p in [7, 11]: eta = +1 if p % 6 == 1 else -1 theta = 2 * p - 2 * eta hi = 6 * p - theta for m in range(1, 9): gaps = [theta if i % 2 == 0 else hi for i in range(m + 1)] assert all(gaps[i] + gaps[i + 1] == 6 * p for i in range(m)) S = sum(gaps[i] + gaps[i + 1] for i in range(m)) T = sum(gaps) assert S == gaps[0] + 2 * sum(gaps[1:m]) + gaps[m] assert 2 * T == S + gaps[0] + gaps[m] assert T >= 3 * p * m # no adjacent pair both >= 3p (theta < 3p appears in every pair) assert not any(gaps[i] >= 3 * p and gaps[i + 1] >= 3 * p for i in range(m)) # 3. LV/LVP superset: two adjacent class-+2 gaps qualify and meet the pair # floor but are not a legal window (non-zero classes do not alternate) for p in [7, 13]: eta = +1 if p % 6 == 1 else -1 cp2 = (3 + eta) * p + 2 assert cp2 % p == 2 and cp2 % p == 2 assert cp2 + cp2 >= 6 * p # LVP pair floor met # legal requires alternation of non-zero classes: +2,+2 is not legal # 4. Lemma 2 class minima + identity for p in [7, 11, 13, 227]: eta = +1 if p % 6 == 1 else -1 c0, cp, cm = 6 * p, (3 + eta) * p + 2, (3 - eta) * p - 2 assert cp + cm == 6 * p assert min(cp, cm, c0) == 2 * p - 2 * eta assert c0 % 6 == cp % 6 == cm % 6 == 0 # 5. c_min(m) = 3pm - (p+2eta)[m odd], attained by alternating theta, 6p-theta for p in [7, 11, 13]: eta = +1 if p % 6 == 1 else -1 theta = 2 * p - 2 * eta for m in range(1, 8): cm = 3 * p * m - (p + 2 * eta) * (m % 2) w = [theta if i % 2 == 0 else 6 * p - theta for i in range(m)] assert sum(w) == cm and cm >= 3 * p * m - p - 2 # 6. min-plus eigenvector v = (0, 3p - c_{-2}) for p in [7, 11, 13]: eta = +1 if p % 6 == 1 else -1 cm2, cp2, c0 = (3 - eta) * p - 2, (3 + eta) * p + 2, 6 * p vA, vB = 0, 3 * p - cm2 assert min(c0 + vA, cm2 + vB) == 3 * p + vA assert min(cp2 + vA, c0 + vB) == 3 * p + vB assert vB == eta * p + 2 # 7. min-plus cycle mean of B_p is 3p for p in [7, 11, 13]: eta = +1 if p % 6 == 1 else -1 cm2, cp2 = (3 - eta) * p - 2, (3 + eta) * p + 2 assert min(6 * p, 6 * p, (cm2 + cp2) / 2) == 3 * p print("ALL CHECKS PASSED") if __name__ == "__main__": main()