#!/usr/bin/env python3 """job #1630 — checks for the prior-art report on return #161 (L(T_x, p)). No network. Two kinds of check: A. arithmetic recomputed from the constants return #161 publishes; B. source-binding: the prior-art data quoted in the report is read back out of the recorded channel evidence and compared with what the report says. Run: python3 job1630-checks.py [evidence_dir] Exits 0 only if every check passes; prints one line per check. """ import json import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) EV = sys.argv[1] if len(sys.argv) > 1 else os.path.join( os.path.dirname(HERE), "evidence") fails = [] n = 0 def check(name, ok, detail=""): global n n += 1 if not ok: fails.append(name) print("%s %s%s" % ("PASS" if ok else "FAIL", name, (" [%s]" % detail) if detail else "")) def primes_upto(k): ps = [] for m in range(2, k + 1): if all(m % q for q in range(2, int(m ** 0.5) + 1)): ps.append(m) return ps # ---------------------------------------------------------------- A. arithmetic # numbers exactly as return #161 states them W29 = 6469693230 # period of the wheel T29 D = 214708725 # twin-admissible slots per period SPECTRUM_P31 = {1: 413380422, 2: 7999018, 3: 12992, 4: 4} # cyclic run spectrum, T29 at p = 31 P = primes_upto(29) check("29# = 6469693230 (product of all primes <= 29)", __import__("math").prod(P) == W29, "prod=%d" % __import__("math").prod(P)) check("D = 214708725 = prod_{3<=q<=29}(q-2) (two-class slot count)", __import__("math").prod([q - 2 for q in P if q >= 3]) == D, "prod=%d" % __import__("math").prod([q - 2 for q in P if q >= 3])) # the identity a cyclic run spectrum must satisfy: every node lies in exactly one # maximal run, so sum_ell ell * count(ell) = number of nodes. Nodes = 2D per the # return's own kill-graph conservation line ("nodes = 2D"). nodes = sum(ell * c for ell, c in SPECTRUM_P31.items()) check("published T29/p=31 spectrum satisfies sum_ell ell*count(ell) = 2D", nodes == 2 * D, "sum=%d 2D=%d" % (nodes, 2 * D)) check("published spectrum is a genuine run spectrum (#runs < nodes, every length positive)", sum(SPECTRUM_P31.values()) < nodes and all(e > 0 for e in SPECTRUM_P31), "runs=%d nodes=%d" % (sum(SPECTRUM_P31.values()), nodes)) check("max run in the T29 column is 4, attained at p = 31 (the return's headline)", max(SPECTRUM_P31) == 4, "max=%d" % max(SPECTRUM_P31)) # diagonal quoted by the return, folds 7..31 diag = [2, 1, 2, 2, 2, 3, 2, 4] check("quoted diagonal L(T_{p-}, p), folds 7..31, is 8 entries ending at 4 for p = 31", len(diag) == 8 and diag[-1] == 4 and 1 in diag and all(1 <= v <= 4 for v in diag), str(diag)) # ------------------------------------------------------------- B. source binding def ev(name): p = os.path.join(EV, name) with open(p) as fh: d = json.load(fh) return d[0] if isinstance(d, list) else d try: a144311 = ev("oeis-A144311.json") a288815 = ev("oeis-A288815.json") a048670 = ev("oeis-A048670.json") have_ev = True except Exception as exc: # pragma: no cover have_ev = False check("OEIS evidence files readable", False, repr(exc)) if have_ev: check("A144311 is the twin-admissible covering sequence quoted in the report", a144311["number"] == 144311 and "1 or -1 modulo at least one of the first n primes" in a144311["name"], a144311["name"][:70]) check("A144311 data begins 1,5,11,29,41,65,107,149,203,257 (report quote)", a144311["data"].startswith("1,5,11,29,41,65,107,149,203,257"), a144311["data"][:40]) check("A288815 = paired Jacobsthal at primorials, Ziller-Morack 1706.00317 linked", a288815["number"] == 288815 and "Paired Jacobsthal" in a288815["name"] and any("1706.00317" in l for l in a288815["link"]), a288815["name"][:60]) check("A288815 data contains 258 at index 8 (the number the report flags as a lead)", a288815["data"].split(",")[7] == "258", a288815["data"][:60]) check("A048670 = Jacobsthal at primorials, one-class analogue", a048670["number"] == 48670 and a048670["name"].startswith("Jacobsthal function A048669"), a048670["name"][:60]) # known match 1: the census constant D of return #161 is an OEIS term a059861 = ev("oeis-lookup-214708725.json") # first hit of the value search check("known match: D = 214708725 = A059861(10) = prod_{i=2..10}(prime(i)-2)", a059861["number"] == 59861 and a059861["data"].split(",")[9] == "214708725", "A%06d %s" % (a059861["number"], a059861["data"][:70])) # known match 2: the return's G2(T29) = 258 is A144311(10) + 1 (max gap, two-class) a144_10 = int(a144311["data"].split(",")[9]) check("known match: G2(T29) = 258 = A144311(10) + 1 with A144311(10) = 257", a144_10 == 257 and a144_10 + 1 == 258 and 258 % 6 == 0, "A144311(10)=%d" % a144_10) # the refined object L is NOT an OEIS term/name hit on the searches run this turn check("no OEIS entry states the per-prime refinement L(T_x, p) (single p >= x): " "all three family hits are whole-set maxima", all("single" not in a["name"].lower() for a in (a144311, a288815, a048670)), "| ".join(a["name"][:40] for a in (a144311, a288815, a048670))) print("\n%d/%d passed" % (n - len(fails), n)) if fails: print("failed: %s" % ", ".join(fails)) sys.exit(1 if fails else 0)