# cert2624.py -- turn a Wang covering tuple (primes 5..P, one residue r_p each, run length LEN = 6*maxm + 5) into an # explicit certificate for route 64's object: a run of consecutive T_37 slots, every one killed by a scour prime # 41..73 at one phase per prime, verified by trial division only. # Mapping (job #2624 report, lemma 2): position j (1 <= j <= maxm) is x_j = 6 j + c, with c chosen by CRT so that the # natal kill classes {6 r_p + c, 6 r_p + c - 2} are {0, -2} mod every p <= 37 and x_j = 5 (mod 6); then # "j not killed by any p <= 37" <=> x_j is a T_37 slot, and the scour phases are a_q = 6 r_q + c mod q. import sys, json, math NAT = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37]; SCOUR = [41, 43, 47, 53, 59, 61, 67, 71, 73] def pskip(p): return next(k for k in range(1, p) if (6 * k) % p == 2 % p) def crt(pairs): x, M = 0, 1 for m, r in pairs: x += M * (((r - x) * pow(M, -1, m)) % m); M *= m return x % M, M def certificate(res, L): maxm = (L - 5) // 6 c, M6 = crt([(6, 5)] + [(p, (-6 * res[p]) % p) for p in NAT]) # c mod 6*37# xs = [6 * j + c for j in range(1, maxm + 1)] slots = [x for x in xs if all(x % p and (x + 2) % p for p in NAT)] # T_37 slots inside the run, by trial division # they are consecutive T_37 slots: no T_37 slot strictly between consecutive members (all positions are x_j's) consecutive = all(not any(all(y % p and (y + 2) % p for p in NAT) for y in range(a + 6, b, 6)) for a, b in zip(slots, slots[1:])) phases = {q: (6 * res[q] + c) % q for q in SCOUR if q in res} killed = [any(x % q == a or (x + 2) % q == a for q, a in phases.items()) for x in slots] # cross-check against Wang's position rule interior_j = [j for j in range(1, maxm + 1) if not any(j % p == res[p] or (j + pskip(p)) % p == res[p] for p in NAT)] assert [6 * j + c for j in interior_j] == slots, 'position rule and trial division disagree' return dict(run_length=L, positions=maxm, c_mod_6x37sharp=c, modulus_6x37sharp=M6, slots=slots, count=len(slots), consecutive=consecutive, phases=phases, all_killed=all(killed), unused_scour_primes=[q for q in SCOUR if q not in res]) if __name__ == '__main__': line = sys.argv[1] if len(sys.argv) > 1 else [l for l in open('../job2040/ties19.out') if l.startswith('TUPLE')][0] parts = line.split(); L = int(parts[-1]); res = {int(t.split('/')[1]): int(t.split('/')[0]) for t in parts[1:-2]} cert = certificate(res, L); cert['tuple'] = line.strip() print(json.dumps(cert, indent=1))