#!/usr/bin/env python3 """Job #1049 (triage, route #15) -- does the sigma-partner stay inside the chunk it was found in? Route 15's success criterion for its one-chunk 43# run is "the recovered set is sigma-closed". The staged 43# run is cut into five chunks of SLOT-TILES, and each chunk covers every one of the NCOPY = 1,348,781,387 copies (staging doc, section on the exact value). A chunk is therefore a range of T_19 slot indices, while sigma is a map on POSITIONS; the two are not obviously compatible. That compatibility decides whether one chunk can ever return a sigma-closed set, and it can be settled with no enumeration at all, from the four 43# positions already in hand. Layout, wheel v = 19, b = 43 (drive43.sh: step 10, 47 tiles, WT 128 words = 8192 slots per tile): position r = s[i] + j * 19# with s[i] the i-th T_19 slot in [0, 19#) tile = i // 8192 chunk = tiles [0,10) [10,20) [20,30) [30,40) [40,47) sigma: r -> K - r (mod 43#), K = -(G2+2) mod 43# = 13082761331669410. Output: JSON on stdout (the artifact); progress on stderr. Usage: python chunk_sigma.py """ import json import sys from math import gcd B = 43 V = 19 G2 = 618 P43 = 2 for p in [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]: P43 *= p P19 = 2 for p in [3, 5, 7, 11, 13, 17, 19]: P19 *= p WT = 128 # words per tile WPERTILE = WT * 64 # slots per tile CHUNKS = [(0, 10), (10, 20), (20, 30), (30, 40), (40, 47)] KNOWN = [830330079152051, # chunk [40,47) least (record) 12252431252517359, # its certified sigma-partner (#426) 1403312099425139, # chunk [0,10) least (record) 11679449232244271] # its certified sigma-partner (#426) def t19_slots(): """The T_19 slots in [0, 19#): r odd, r and r+2 coprime to 19#.""" alive = bytearray(b"\x01") * P19 for p in [2, 3, 5, 7, 11, 13, 17, 19]: alive[0::p] = b"\x00" * len(alive[0::p]) alive[(p - 2) % p::p] = b"\x00" * len(alive[(p - 2) % p::p]) return [r for r in range(P19) if alive[r]] def main(): S = t19_slots() sys.stderr.write("D_19 = %d slots in 19# = %d (tiles = %d at %d slots)\n" % (len(S), P19, (len(S) + WPERTILE - 1) // WPERTILE, WPERTILE)) rank = {s: i for i, s in enumerate(S)} K = (-(G2 + 2)) % P43 sys.stderr.write("K = -(G2+2) mod 43# = %d ; 43# = %d\n" % (K, P43)) def where(r): i = rank.get(r % P19) if i is None: return None j = (r - S[i]) // P19 assert S[i] + j * P19 == r, "layout mismatch" tile = i // WPERTILE ch = [c for c in CHUNKS if c[0] <= tile < c[1]] return dict(pos=r, i=i, j=j, tile=tile, chunk=str(ch[0]) if ch else "out") rows = [] for r in KNOWN: w = where(r) assert w is not None, "not a T_19 slot: %d" % r w["partner"] = (K - r) % P43 w["partner_where"] = where(w["partner"]) w["same_chunk"] = (w["chunk"] == w["partner_where"]["chunk"] if w["partner_where"] else None) w["gap_forward"] = w["partner"] - r rows.append(w) sys.stderr.write("pos %d slot i=%d j=%d tile=%d chunk=%s -> partner %d " "(slot %d, tile %d, chunk %s) same_chunk=%s\n" % (r, w["i"], w["j"], w["tile"], w["chunk"], w["partner"], w["partner_where"]["i"], w["partner_where"]["tile"], w["partner_where"]["chunk"], w["same_chunk"])) sum_check = sorted(r + (K - r) % P43 for r in KNOWN) out = dict(P43=P43, P19=P19, D19=len(S), K=K, G2=G2, K_identity_holds=all((s % P43) == K % P43 for s in sum_check), rows=rows, chunk_leasts={str(c[0]): None for c in CHUNKS}) print(json.dumps(out, indent=1)) if __name__ == "__main__": main()