#!/usr/bin/env python3 """Job 975: depth-1 certificate for n = 51 (L = 3131) with anchor 109, tree959 format. .venv/bin/python cert51975.py > cert51975.out # writes tree975-51-109.cert.jsonl """ import hashlib, json, sys import anchor975 as a9 sys.stdout.reconfigure(newline='\n') n, q0 = 51, 109 D = a9.rw.slots_from(a9.A, n, a9.OLD) rec = [{'path': [], 'branch': q0}] for b in range(q0): R, v, (verdict, c) = a9.branch(D, q0, b) assert verdict == 'STRICT', (b, verdict) rec.append({'path': [[q0, b]], 'w': c[2]}) body = ''.join(json.dumps(r, separators=(',', ':')) + '\n' for r in rec) open(f'tree975-{n}-{q0}.cert.jsonl', 'w', newline='\n').write(body) print(f'tree975-{n}-{q0}.cert.jsonl: {len(rec)} records, sha256 {hashlib.sha256(body.encode()).hexdigest()}')