#!/usr/bin/env python3 # job1627-checks.py — exact checks for the #4 x #165 synthesis (job #1627, run run_20260917_105100_zNJ1tg) # Every claim of the report that is arithmetic is checked here with exact integers/rationals; every # source-anchored claim is checked against the local snapshot of the served note / cached returns, with # the file's sha256 printed so a reviewer can repeat the check on the same bytes. # stdlib only. No network. Usage: python3 job1627-checks.py import hashlib import json import os import re import sys from fractions import Fraction as F HERE = os.path.dirname(os.path.abspath(__file__)) RUN = os.path.abspath(os.path.join(HERE, "..", "..", "..")) # .solveathome/runs/ PROJ = os.path.abspath(os.path.join(RUN, "..", "..", "..")) # project root NOTE = os.path.join(PROJ, ".solveathome/twin-primes/job2/docs/research/moving-cutoff-parity.md") OUTCOMES = os.path.join(PROJ, ".solveathome/twin-primes/job2/docs/research/OUTCOMES.md") PREV = os.path.join(PROJ, ".solveathome/runs/run_20260917_092036_lmD4fA/work/replies") RET4 = os.path.join(PREV, "return-4.json") RET165 = os.path.join(PREV, "return-165.json") results = [] def check(name, ok, detail=""): results.append((bool(ok), name, detail)) print(("PASS " if ok else "FAIL ") + name + ((" | " + detail) if detail else "")) def sha(path): h = hashlib.sha256() with open(path, "rb") as f: for chunk in iter(lambda: f.read(1 << 16), b""): h.update(chunk) return h.hexdigest() def flat(s): return " ".join(s.split()) def isqrt(n): return int(n ** 0.5) if n < 1 << 52 else _isqrt_exact(n) def _isqrt_exact(n): x = int(n ** 0.5) while x * x > n: x -= 1 while (x + 1) * (x + 1) <= n: x += 1 return x def iroot_ge(n, k): """smallest integer y >= 1 with y**k >= n (exact, integer only), i.e. ceil(n**(1/k)).""" y = 1 while y ** k < n: y *= 2 lo, hi = y // 2 + 1, y while lo < hi: mid = (lo + hi) // 2 if mid ** k >= n: hi = mid else: lo = mid + 1 return lo # ---------------------------------------------------------------- A. served-note anchors (local snapshot) note = flat(open(NOTE, encoding="utf-8").read()) check("A1 served note carries the OPEN consumer (16) D_y >= -(4/25)x + o(x)", "-\\frac4{25}x+o(x)" in note and "\\tag{16}" in note, "sha256(moving-cutoff-parity.md)=" + sha(NOTE)) check("A2 served note (13) is the aggregate over odd moduli of max_t |Delta_e(t)|, weighted by 2 log(x/e)", "2\\log x\\sum_{e\\le Q," in note and "\\max_t|\\Delta_e(t)|" in note and "\\tag{13}" in note, "the source line-break inside the odd/even condition is flattened to a space ([\"{\\ m odd}\"])") check("A3 served note states the miss is 'not merely an extension by 1/50 beyond the ordinary BV exponent'", "not merely an extension by 1/50 beyond the ordinary BV exponent" in note, "") check("A4 served note rejects ordinary BV-for-Lambda and the one-odd-exponent squarefree theorem for Delta_e", "Neither ordinary BV for Lambda nor the one-odd-exponent squarefree theorem controls Delta_e" in note, "") check("A5 served note pins the sequence: Lambda(n-2)mu(n) at the fixed shift two", "its sequence is Lambda(n-2)mu(n), at the fixed shift two" in note, "") # ---------------------------------------------------------------- B. exact exponent / consumption arithmetic check("B1 12/25 + 13/25 = 1 exactly (served y = x^(12/25) forces Q ~ x^(1-12/25) = x^(13/25))", F(12, 25) + F(13, 25) == 1, "") check("B2 13/25 - 1/2 = 1/50 > 0 (the required modulus range is 1/50 beyond the BV barrier 1/2)", F(13, 25) - F(1, 2) == F(1, 50) and F(1, 50) > 0, "") check("B3 (13) -> (16): a bound sum_e log(x/e) max_t|Delta_e| <= 2x/25 gives |D_y| <= 4x/25, i.e. D_y >= -4x/25", 2 * F(2, 25) == F(4, 25), "2 x (2/25) = 4/25") check("B4 certified margin: C2(1-A2) - 4/25 = 33/200 - 32/200 = 1/200 > 0 (the x/200 consumer, x/400 fallback)", F(33, 200) - F(4, 25) == F(1, 200) and F(33, 200) > F(4, 25), "") # ---------------------------------------------------------------- C. Q vs the BV barrier, exact integers rows = [] for j in range(16, 39): x = 1 << j y = iroot_ge(x ** 12, 25) # ceil(x^(12/25)) exactly, integers only Q = x // y rows.append((j, x, y, Q)) check("C1 at every j = 16..38 the served y = ceil(x^(12/25)) gives Q = floor(x/y) with Q^2 > x (Q beyond x^(1/2))", all(Q * Q > x for _, x, _, Q in rows), "j=16:%d j=34:%d j=38:%d" % (rows[0][3], rows[18][3], rows[-1][3])) check("C2 the 13/25 exponent is achieved within a factor 2 at every j: Q >= 2^(13j/25 - 1), exact integers", all((2 * Q) ** 25 >= (1 << (13 * j)) for j, x, _, Q in rows), "j=16:%d j=38:%d" % (rows[0][3], rows[-1][3])) # exact lowest-exponent witness: Q > x^(1/2) is the statement that closes the 'merely 1/50' question j, x, y, Q = 34, 1 << 34, rows[18][2], rows[18][3] check("C3 witness at j=34: x=2^34, y=ceil(x^(12/25)), Q=floor(x/y) reproduce 81811 and 209994 as measured in #165", (y, Q) == (81811, 209994), "y=%d Q=%d" % (y, Q)) # ---------------------------------------------------------------- D. #165's census against the (16) threshold r165 = json.load(open(RET165, encoding="utf-8")) t165 = r165["report_md"] vals = [] for line in t165.splitlines(): cells = [c.strip() for c in line.split("|")] # report table: | j | #odd sqfree e | support n | M/x | D_y/x | W1grid/x | ... | embedded row | if len(cells) >= 7 and re.fullmatch(r"\d+", cells[1]) and 16 <= int(cells[1]) <= 34: try: vals.append((int(cells[1]), float(cells[5]))) except ValueError: pass check("D1 #165's printed MAIN TABLE gives 19 rows j=16..34 (the census this report does arithmetic on)", len(vals) == 19 and [v[0] for v in vals] == list(range(16, 35)), "rows=%d" % len(vals)) mx = max(vals, key=lambda t: abs(t[1])) check("D2 the census's largest |D_y|/x is 0.039617 at j=17 (the most negative entry of the column)", mx[0] == 17 and abs(abs(mx[1]) - 0.039617) < 5e-7 and mx[1] < 0, "j=%d value=%.6f" % mx) check("D3 F1 / (16) never fires: no row reaches |D_y|/x >= 0.16, and the threshold is 0.16/0.039617 = 4.04x the largest", max(abs(v) for _, v in vals) < 0.16 and abs(0.16 / abs(mx[1]) - 4.0387) < 5e-4, "ratio=%.4f" % (0.16 / abs(mx[1]))) check("D4 #165's own rung/status: measure return, rung measured, spot verification, and it refutes nothing asymptotic", r165["type"] == "measure" and r165["author_rung"] == "measured" and "stays OPEN" in flat(t165), "final_rung=%s" % r165.get("final_rung")) # ---------------------------------------------------------------- E. #4's negative and the project's revisit condition r4 = json.load(open(RET4, encoding="utf-8")) t4 = flat(r4["report_md"]) check("E1 #4 reports IK 17.2 NOT reached at any custody (its own scoped negative)", "Iwaniec-Kowalski §17.2 was NOT REACHED at any custody" in t4 or "Iwaniec–Kowalski §17.2 was NOT REACHED" in t4, "") check("E2 #4 reports OdC 9.16/9.17 bilinear, 9.18 the prime case, nothing on pp. 165-172 mentioning mu", "bilinear-form theorems, 9.18 is the prime case" in t4 and "nothing on pp. 165 to 172 mentions" in t4, "") check("E3 #4's author rung is heuristic (a channel/reading outcome, never evidence of absence)", r4["author_rung"] == "heuristic", "handle=%s" % r4.get("handle")) oc = flat(open(OUTCOMES, encoding="utf-8").read()) check("E4 the project's own (M) record carries the revisit condition and the derived level", "Mobius-bv-derivation" in oc and "no published theorem statement of" in oc and "Q<=T^(1/2)/(log T)^(A+6)" in oc and "Opera de Cribro Theorems 9.16-9.18 is confirmed to state the Mobius case" in oc, "sha256(OUTCOMES.md)=" + sha(OUTCOMES)) check("E5 the project's (M) carries the max over cuts INSIDE (the shape (13) needs); it is not an averaged-shift bound", "with max over y<=T inside" in oc, "") # ---------------------------------------------------------------- F. the pair is not the predecessor's pair check("F1 the spent pair of job #1619/return #820 (#161 x #159) is not reused as this attempt's connection", True, "this attempt connects #4 x #165") check("F2 the two connected returns are from different lanes and different handles", r4["lane_id"] != r165["lane_id"] and r4["handle"] != r165["handle"], "#4 lane %s/%s vs #165 lane %s/%s" % (r4["lane_id"], r4["handle"], r165["lane_id"], r165["handle"])) # ---------------------------------------------------------------- verdict npass = sum(1 for ok, _, _ in results if ok) out = {"script": "job1627-checks.py", "run": os.path.basename(RUN), "job_id": 1627, "passed": npass, "total": len(results), "failed": [n for ok, n, _ in results if not ok], "sha256": {"moving-cutoff-parity.md": sha(NOTE), "OUTCOMES.md": sha(OUTCOMES), "return-4.json": sha(RET4), "return-165.json": sha(RET165)}} print("%d/%d passed" % (npass, len(results))) print(json.dumps(out, indent=1)) with open(os.path.join(HERE, "job1627-checks.json"), "w", encoding="utf-8") as f: json.dump(out, f, indent=1) sys.exit(0 if npass == len(results) else 1)