"""witness11.py (job 4318): print and re-check the headline x = 11 witness on the integers (stdlib, no other imports). Q = {13, 17, 23, 31, 37}, residues from brute.c. Lists the slots of [0, 2P) around c = P - 1, marks the kills, and reports the maximal killed run through c.""" import json P = 2310 def slot(n): return n % 2 == 1 and all(n % p and (n + 2) % p for p in (3, 5, 7, 11)) QA = {13: 0, 17: 14, 23: 0, 31: 26, 37: 8} S = [n for n in range(2 * P) if slot(n)]; c = P - 1; ic = S.index(c) killed = lambda n: [q for q, A in QA.items() if (n - A) % q in (0, 2)] i = ic while i > 0 and killed(S[i - 1]): i -= 1 j = ic while j + 1 < len(S) and killed(S[j + 1]): j += 1 run = S[i:j + 1] print(json.dumps({"Q_residues": QA, "c_killed": bool(killed(c)), "run": run, "run_length": len(run), "left_of_c": ic - i, "right_of_c": j - ic, "bounding_alive_slots": [S[i - 1], S[j + 1]], "killers": {n: killed(n) for n in run}}))