""" QUESTION (pre-registered; job #2101). On tile T_x (primes 5..x) with entering prime q, let f_1 = (#slots killed by q, residues {0, q-2}) / D -- expected exactly 2/q by CRT f_2 = (#consecutive slot pairs (r_i, r_{i+1}) BOTH killed) / D -- cyclic, true continuation Under independent placement of kills, f_2 = f_1^2 = 4/q^2. Return #1125 (this run) saw the longest anchored run sit BELOW the permutation null at every fold (T_13..T_23). Is that because adjacent kills are genuinely anti-clustered (f_2 < 4/q^2 by a factor bounded away from 1), or an artefact of the extreme statistic? Falsifier for the route premise: rho := f_2 / (4/q^2) within 0.9..1.1 at all four folds => no anti-clustering to exploit; route dead at the first check. Exact control: the pair (r, r') with gap g = r' - r is both-killed iff r mod q in {0,q-2} AND (r+g) mod q in {0,q-2}; for a FIXED gap g the CRT density is |{a in {0,q-2} : a+g mod q in {0,q-2}}|/q, so the exact f_2 = sum over gap classes g of (#pairs with gap g)/D * c(g)/q with c(g) in {0,1,2}. The scan reproduces this identity (G) as its correctness control. """ import json, os, sys, time import numpy as np sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "p2097")) from lanch import tile, next_prime out = [] for x in (13, 17, 19, 23): q = next_prime(x); t0 = time.time() slots, M = tile(x); D = len(slots) r1 = slots % q r2 = (slots + (M % q)) % q k = (r1 == 0) | (r1 == q - 2) knext = np.concatenate([k[1:], [(r2[0] == 0) | (r2[0] == q - 2)]]) # successor of the last slot is slot 0 of the next period pairs = int((k & knext).sum()) f1 = k.sum() / D; f2 = pairs / D # exact CRT control via gap classes gaps = np.concatenate([np.diff(slots), [slots[0] + M - slots[-1]]]) % q vals, cnt = np.unique(gaps, return_counts=True) c = np.array([sum(1 for a in (0, q - 2) if (a + g) % q in (0, q - 2)) for g in vals]) f2_exact = float((cnt * c).sum() / D / q) rho = f2 / (4 / q ** 2) rec = {"x": x, "q": q, "D": D, "f1": f1, "f1_expected": 2 / q, "f2": f2, "f2_exact_crt": f2_exact, "G_identity_ok": abs(f2 - f2_exact) < 1e-12, "independence_4_over_q2": 4 / q ** 2, "rho": rho, "gap_classes_with_c2": int((c == 2).sum()), "gap_classes_with_c1": int((c == 1).sum()), "gap_classes_with_c0": int((c == 0).sum()), "seconds": round(time.time() - t0, 2)} out.append(rec); print(json.dumps(rec), flush=True) verdict = "FALSIFIED: rho within 0.9..1.1 at all folds" if all(0.9 <= r["rho"] <= 1.1 for r in out) else \ "NOT FALSIFIED: rho outside 0.9..1.1 at x=%s" % [r["x"] for r in out if not 0.9 <= r["rho"] <= 1.1] json.dump({"job": 2101, "folds": out, "verdict": verdict}, open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "pairkill.json"), "w"), indent=1) print(json.dumps({"verdict": verdict}))