"""Certify copy-scan hits at 31# and 41# with the served ancestry test of #424 (splits.analyse re-checks each gap directly by gcd over x#), check sigma closure and report the orbit classes. Job 2014, route 15. Usage: python3 certify.py""" import json import splits as P LEVELS = [(31, 29, 348, ["8813641451", "191746848329"]), (41, 37, 546, ["3784200788231", "300466062738431"])] res = [] for X, PREV, G, seeds in LEVELS: N = P.primorial(X) K = (-(G + 2)) % N hits = sorted(int(l.split()[0]) for s in seeds for l in open(f"scan-{X}-{s}.out") if l.strip()) pos = [] for s in hits: a = P.analyse(X, PREV, s, G) pos.append(dict(pos=s, res19=s % 9699690, partner=K - s, partner_in_set=(K - s) in hits, L=a["L"], gaps=a["gaps"], share=a["share"])) orbits = sorted({tuple(sorted((s, K - s))) for s in hits}) res.append(dict(x=X, G=G, K=K, n=len(hits), residues19=sorted({p["res19"] for p in pos}), orbits=[list(o) for o in orbits], sigma_closed=all(p["partner_in_set"] for p in pos), positions=pos)) print(json.dumps(res, indent=1))