SPB Git forge
3commits 1branches 0releases
1.0 MBsize
maindefault branch
1 mo agolast push
Python 64.3% TeX 35.7%
2.5 KB · 72 lines python
Raw Blame History
1#!/usr/bin/env python32# =============================================================================3# verify_c2_refutation.py — INDEPENDENT re-verification of the C2 counterexample4# Author: Simon-Pierre Boucher — contact@spboucher.ai5# =============================================================================6# Claim refuted: "N(2,x) > N(4,x) for all x >= 10^6"  (C2, cycle 1)7# where N(g,x) counts consecutive prime pairs (p, p+g) with p+g <= x.8# This script recomputes, stdlib-only (bytearray sieve, no numpy, no /src):9#   - D(p) = N2 - N4 after each prime p (gaps attributed to their END prime),10#   - checks D(p) > 0 for every end-prime p in (10^6, 80966861),11#   - checks D = 0 at end-prime 80966861 (first tie),12#   - checks D = -1 at end-prime 80966933 (first strict overtake by gap 4).13# Runtime ~ 30 s pure Python. Exit 0 + "VERIFICATION PASSED" iff all hold.14# =============================================================================1516import sys1718LIMIT = 81_000_00019FIRST_TIE = 80_966_86120FIRST_NEG = 80_966_933212223def main():24    sieve = bytearray([1]) * (LIMIT + 1)25    sieve[0] = sieve[1] = 026    for i in range(2, int(LIMIT ** 0.5) + 1):27        if sieve[i]:28            sieve[i * i:: i] = bytearray(len(sieve[i * i:: i]))29    D = 030    prev = 231    ok_positive = True32    tie_val = neg_val = None33    min_after_1e6 = None34    for p in range(3, LIMIT + 1, 2):35        if not sieve[p]:36            continue37        g = p - prev38        if g == 2:39            D += 140        elif g == 4:41            D -= 142        prev = p43        if 10**6 < p < FIRST_TIE and D <= 0:44            ok_positive = False45            print(f"unexpected D<=0 at {p}: D={D}")46        if p == FIRST_TIE:47            tie_val = D48        if p == FIRST_NEG:49            neg_val = D50    failures = []51    if not ok_positive:52        failures.append("D not strictly positive on (10^6, 80966861)")53    if tie_val != 0:54        failures.append(f"D at {FIRST_TIE} is {tie_val}, expected 0")55    if neg_val != -1:56        failures.append(f"D at {FIRST_NEG} is {neg_val}, expected -1")57    if failures:58        print("VERIFICATION FAILED:")59        for f in failures:60            print("  -", f)61        sys.exit(1)62    print("VERIFICATION PASSED:")63    print(f"  D(p) > 0 for every end-prime p in (10^6, {FIRST_TIE})")64    print(f"  D({FIRST_TIE}) = 0   (first tie after 10^6)")65    print(f"  D({FIRST_NEG}) = -1  (first strict N4 > N2 after 10^6)")66    print("  => C2 is REFUTED; minimal counterexample x = 80966861 (tie), "67          "80966933 (strict).")686970if __name__ == "__main__":71    main()72