"""Job #4495: orbit classes (splits) of every certified position, 23#..47#. Definition, reconstructed from the served tables of #426/#1073/#1791 and checked against them here (PRE-REGISTERED G6): the split of a maximal gap [p, p+G] at level x is the list of sub-gaps cut by the T_w slots strictly inside it, w = the prime before x (the points killed by x alone); L = number of pieces; share = (sum of the inner pieces, first and last excluded) / G. G6: the served splits reproduce: 31# [138,60,150]/[180,60,108] (and reversals), 37# [66,72,222,168], 41# [90,246,84,126], 43# [156,84,378] and [168,450] (with reversals).""" import json, os from math import gcd HERE = os.path.dirname(os.path.abspath(__file__)) PR = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] def prim(x): r = 1 for q in PR: if q <= x: r *= q return r f = json.load(open(os.path.join(HERE, 'fresh4495.json'))) e = json.load(open(os.path.join(HERE, 'ext4495.json'))) levels = {int(x): (v['G'], v['positions']) for x, v in f['positions'].items()} levels[47] = (e['G2_47'], e['positions']) SERVED = {31: [[138, 60, 150], [180, 60, 108]], 37: [[66, 72, 222, 168]], 41: [[90, 246, 84, 126]], 43: [[156, 84, 378], [168, 450]]} ok6 = True for x in sorted(levels): G, pos = levels[x]; w = PR[PR.index(x) - 1]; Pw = prim(w) rows = [] for p in pos: cut = [k for k in range(6, G, 6) if gcd((p + k) * (p + k + 2), Pw) == 1] pts = [0] + cut + [G]; gaps = [b - a for a, b in zip(pts, pts[1:])] rows.append((p, gaps)) classes = {} for p, g in rows: key = min(tuple(g), tuple(reversed(g))) classes.setdefault(key, []).append(p) if x in SERVED: want = {min(tuple(g), tuple(reversed(g))) for g in SERVED[x]} ok6 = ok6 and set(classes) == want print(f"x={x} G={G} nmax={len(pos)}: " + '; '.join(f"L={len(k)} gaps {list(k)}/rev share {sum(k[1:-1])}/{G} = {sum(k[1:-1]) / G:.6f}: {len(v)} positions ({len(v) // 2} orbits)" for k, v in sorted(classes.items()))) print(f"{'PASS' if ok6 else 'FAIL'} G6_split_definition_reproduces_served :: 31#, 37#, 41#, 43# classes equal the served ones")