"""blockcover7.py (job 4318): an explicit k = 5 cover of all 15 slots of T_7's block, with residues. Uses certk.leaves only to propose multi-killer sets M; residues are then found by brute force over prod Z/q and the cover is re-checked on the integers (verify7.py checks it again independently).""" import json from itertools import product from certk import primes_upto, tile, Family, leaves, minimal small = primes_upto(1000); P, D, r = tile(7, small); fam = Family(r, 7, small) Ms = minimal(leaves(fam, (1 << D) - 1, 5)) print(json.dumps({"k": 5, "minimal_M": [sorted(m) for m in Ms]})) M = tuple(sorted(Ms[0])); singles = 5 - len(M) big = [q for q in small if q > 2 * P + 2][:singles] for As in product(*(range(q) for q in M)): alive = [n for n in r if not any((n - A) % q in (0, 2) for q, A in zip(M, As))] if len(alive) <= singles: cov = [[q, A] for q, A in zip(M, As)] + [[q, n % q] for q, n in zip(big, alive)] print(json.dumps({"cover": cov})); break