#!/usr/bin/env python3 """Job #1485 — decisive follow-up to job1485-rungcount.py: WHICH SLOT SET does the ladder's L use? Written 2026-09-16T13:02Z, after the unit-word run completed at 12:47Z (instrument job1485-rungcount.py, attached). rungcount used the module job1444-threeway.py's `admissible(x, M)` = slots coprime to x# (units mod x#, count phi(x#) = 8, 48, 480, 5760, 92160 at levels 5..17) and found A >= 1 in 122/122 + 65/65 of the corpus rows whose bank L = 1. The corpus's OWN D field is 3 at level 5 and 1485 at level 13 - not phi(x#) - and 3, 1485 are exactly prod_{odd p <= x}(p-2), the count of n in one period with gcd(n(n+2), x#) = 1, i.e. the project's TWIN slots. So the two words are different objects. HYPOTHESIS H_twin (formed after the unit-word run - recorded as post-hoc, not pre-registered): the corpus's L column is computed on the twin-slot word, and #1444's 122/126 gap is the slot-set conflation, not a corpus error. TEST (decided by this script): for every bank row in levels 5, 7, 11, 13, 17, compute L_doc and A on (i) the unit word and (ii) the twin word, and report which word reproduces the bank column. FALSIFIER of H_twin (post-hoc, stated before this run): if the twin word reproduces the bank column in no more rows than the unit word does, H_twin is falsified and route 34's producer run remains the only adjudication. GATE: the twin word's slot counts must equal the bank's own D field (3, 15, 135, 1485, 22275) - if they do not, the D field names some third slot set and this test answers nothing. Reuses job1485-rungcount.py (l_doc / a_count) and job1444-threeway.py (primes_upto) unmodified. """ import importlib.util import json import pathlib import sys import time import numpy as np # Paths resolved from this file's own location (never a per-user home path). SAH = pathlib.Path(__file__).resolve().parents[3] # the .solveathome root BASE = str(SAH / "runs/run_20260916_144430_LWnz2Q/work") + "/" BANK = str(SAH / "runs/run_20260916_115338_mH5kbg/work/L-grid-622.json") def load(path, name): spec = importlib.util.spec_from_file_location(name, path) m = importlib.util.module_from_spec(spec) spec.loader.exec_module(m) return m def main(): t0 = time.time() rc = load(BASE + "job1485-rungcount.py", "job1485_rc") m44 = load(rc.MOD_PATH, "job1444") out = {"job": 1485, "instrument": "job1485-twinslots.py", "bank": BANK, "hypothesis": "corpus L is computed on the twin-slot word (gcd(n(n+2), x#) = 1)", "levels": {}, "rows": [], "summary": {}} bank = {} for r in json.loads(pathlib.Path(BANK).read_text())["rows"]: bank[(int(r["level"]), int(r["p"]))] = r for x in (5, 7, 11, 13, 17): primes = m44.primes_upto(x) M = 1 for q in primes: M *= q units = [n for n in range(M) if all(n % q for q in primes)] twins = [n for n in range(M) if all(n % q for q in primes) and all((n + 2) % q for q in primes)] expect_twin = 1 for q in primes: if q > 2: expect_twin *= (q - 2) u = np.array(units, dtype=np.int64) t = np.array(twins, dtype=np.int64) lv = {"x": x, "M": M, "units": len(units), "twins": len(twins), "expected_twin_slots": expect_twin, "twin_slots_match_D": len(twins) == expect_twin, "bank_D_values": sorted({int(v.get("D", -1)) for (lx, _), v in bank.items() if lx == x})} out["levels"][str(x)] = lv ps = [q for q in m44.primes_upto(200) if q > x] for p in ps: ru = u % p rt = t % p l_u = rc.l_doc(ru, p) l_t = rc.l_doc(rt, p) a_u = rc.a_count(ru, p, seam_val=(int(units[0]) + M) % p)[0] a_t = rc.a_count(rt, p, seam_val=(int(twins[0]) + M) % p)[0] b = bank.get((x, p)) out["rows"].append({"x": x, "p": p, "bank_L": (b or {}).get("L"), "bank_D": (b or {}).get("D"), "L_unit": l_u, "A_unit": a_u, "L_twin": l_t, "A_twin": a_t, "twin_matches_bank": (bool(b) and b["L"] == l_t), "unit_matches_bank": (bool(b) and b["L"] == l_u)}) print(f"level {x}: M={M} units={len(units)} twins={len(twins)} " f"expected_twins={expect_twin} bank_D={lv['bank_D_values']}", file=sys.stderr) rows = [r for r in out["rows"] if r["bank_L"] is not None] s = {"rows_compared": len(rows), "unit_word_matches_bank": sum(1 for r in rows if r["unit_matches_bank"]), "twin_word_matches_bank": sum(1 for r in rows if r["twin_matches_bank"]), "twin_word_mismatches": [{"x": r["x"], "p": r["p"], "bank_L": r["bank_L"], "L_twin": r["L_twin"], "L_unit": r["L_unit"]} for r in rows if not r["twin_matches_bank"]], "bank_rows_L1_with_A_twin_ge_1": [{"x": r["x"], "p": r["p"]} for r in rows if r["bank_L"] == 1 and r["A_twin"] >= 1], "by_level": {}} for x in (5, 7, 11, 13, 17): sel = [r for r in rows if r["x"] == x] s["by_level"][str(x)] = {"rows": len(sel), "unit_matches": sum(1 for r in sel if r["unit_matches_bank"]), "twin_matches": sum(1 for r in sel if r["twin_matches_bank"])} s["H_twin_falsified"] = bool(s["twin_word_matches_bank"] <= s["unit_word_matches_bank"]) s["all_twin_slot_counts_match_bank_D"] = all(v["twin_slots_match_D"] for v in out["levels"].values()) out["summary"] = s out["elapsed_s"] = round(time.time() - t0, 2) pathlib.Path(BASE + "job1485-twinslots.json").write_text(json.dumps(out, indent=1, sort_keys=True)) print(json.dumps({"summary": s, "levels": out["levels"]}, sort_keys=True)) print(f"elapsed {out['elapsed_s']}s", file=sys.stderr) if __name__ == "__main__": main()