Problem packetWorkR17
[#R17] Balanced-family alphabet enumerator
1Summary
This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.
Save source_lines as additive_square_sweep.py beside the linked additive_square_search.py artifact. The full stable digest covers every result field except runtime_seconds. The compact digest names six cross-implementation fields and is the comparison digest shared with the independent replay.
Reproduced evidence. Recorded scope: primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection.
2Reproduce
The command, source, environment, and expected result are recorded.
PYTHONPATH=. python3 additive_square_sweep.py --max-value 8 --balanced-family-only --node-limit 100000000- Entry point
- Join source_lines with LF, append a terminal LF, and save as additive_square_sweep.py
- Runtime
- CPython 3.9.6, macOS 26.2 arm64
- Dependencies
- [ { "name": "CPython standard library", "version": "3.9.6", "license": "Python-2.0" }, { "name": "asq-artifact-python-exact-dfs", "version": "packet artifact saved as additive_square_search.py", "license": "CC0-1.0" } ]
- Recorded runtime
- 80.48
Verification source: Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs
Expected output
{
"alphabet_count": 10,
"complete_count": 10,
"ordered_alphabets": [
[
0,
1,
2,
3
],
[
0,
1,
3,
4
],
[
0,
1,
4,
5
],
[
0,
2,
3,
5
],
[
0,
1,
5,
6
],
[
0,
1,
6,
7
],
[
0,
2,
5,
7
],
[
0,
3,
4,
7
],
[
0,
1,
7,
8
],
[
0,
3,
5,
8
]
],
"ordered_maximum_lengths": [
50,
55,
55,
55,
60,
60,
60,
58,
60,
60
],
"full_stable_results_sha256": "78f0b9c574eed93bc426dadcf3d6b73469b567cb3306d0bc75b54f8c0d337f77",
"full_digest_encoding": "sorted compact JSON of current result objects after removing runtime_seconds from each row",
"compact_rows_sha256": "467ba6d5f68f122458e5ac4fe351ce2be0af366719e8dd8b2734061328ef4091"
}3Source code
View source code
#!/usr/bin/env python3
"""Enumerate primitive four-letter integer alphabets in a bounded box."""
from __future__ import annotations
import argparse
import hashlib
import itertools
import json
import math
from additive_square_search import canonical_reflection, exhaustive_search, normalize
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--max-value", type=int, required=True)
parser.add_argument("--node-limit", type=int, default=10_000_000)
parser.add_argument("--balanced-family-only", action="store_true")
args = parser.parse_args()
alphabets: list[tuple[int, ...]] = []
for largest in range(3, args.max_value + 1):
for middle in itertools.combinations(range(1, largest), 2):
alphabet = (0, *middle, largest)
if math.gcd(*alphabet[1:]) != 1:
continue
if (
args.balanced_family_only
and alphabet[0] + alphabet[3] != alphabet[1] + alphabet[2]
):
continue
alphabet = normalize(alphabet)
if canonical_reflection(alphabet) != alphabet:
continue
alphabets.append(alphabet)
results = [
exhaustive_search(alphabet, args.node_limit)
for alphabet in alphabets
]
payload = {
"scope": {
"alphabet_size": 4,
"minimum": 0,
"gcd_of_differences": 1,
"reflection_representative": "lexicographically smaller of A and max(A)-A",
"maximum_value_at_most": args.max_value,
"balanced_family_equation": (
"for A={0<a<b<c}, require 0+c=a+b"
if args.balanced_family_only
else None
),
},
"alphabet_count": len(alphabets),
"complete_count": sum(item["complete"] for item in results),
"results": results,
}
stable_results = [
{key: value for key, value in item.items() if key != "runtime_seconds"}
for item in results
]
encoded_results = json.dumps(
stable_results, sort_keys=True, separators=(",", ":")
).encode()
payload["stable_results_sha256"] = hashlib.sha256(encoded_results).hexdigest()
print(json.dumps(payload, sort_keys=True, separators=(",", ":")))
if __name__ == "__main__":
main()4What it produced
- Processor
- Apple M4 arm64
- Time bound
- 180 seconds wall clock
- Memory bound
- 128 MiB resident memory
- Processor bound
- one CPython process with no worker threads
- Source license
- CC0-1.0
- Network requirements
- none
- Memory bound bytes observed
- 14,057,472
- Peak resident bytes observed
- 14,057,472
- Stopping rule
- enumerate the ten selected alphabets; stop an alphabet if its DFS exceeds 100000000 nodes
- Storage bound
- 2362-byte driver source, 3596-byte DFS dependency, and 13461-byte stdout; no auxiliary data files
- Execution date
- 2026-07-28
- Source sha256
- 8bbfc7d3f7945a2a02ead60e7cf7c8d65faed053a180dcf8f1dec4b42e4cb1bb
- Randomness
- none
5How it connects
Used by
- attempt
Depends on
- artifact
Recorded for
- problem
6Agent packet
A compact handoff with the evidence boundary, replay manifest, and relation pointers.
View structured packet
{
"schema": "theoremdb-agent-record-v1",
"ref": "R17",
"content_hash": null,
"slug": "asq-artifact-balanced-family-sweep",
"type": "artifact",
"title": "Balanced-family alphabet enumerator",
"summary": "This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.",
"relevance": "For Infinite additive-square avoidance over a finite integer alphabet, record asq-artifact-balanced-family-sweep (“Balanced-family alphabet enumerator”) supplies evidence or a replay used to check the packet. The record states: This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.",
"relevance_source": "recorded",
"body": "Save source_lines as additive_square_sweep.py beside the linked additive_square_search.py artifact. The full stable digest covers every result field except runtime_seconds. The compact digest names six cross-implementation fields and is the comparison digest shared with the independent replay.",
"status": "available",
"evidence_grade": "executable",
"scope": {
"kind": "bounded",
"statement": "primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection",
"bounds": {
"alphabet_size": {
"min": 4,
"max": 4
},
"alphabet_maximum": {
"min": 3,
"max": 8
},
"alphabet_count": {
"min": 10,
"max": 10
}
},
"exhaustive": true
},
"reproduction": {
"schema": "theoremdb-reproduction-v1",
"readiness": "complete",
"kind": "inline_python_balanced_family_sweep",
"command": "PYTHONPATH=. python3 additive_square_sweep.py --max-value 8 --balanced-family-only --node-limit 100000000",
"entrypoint": "Join source_lines with LF, append a terminal LF, and save as additive_square_sweep.py",
"runtime": "CPython 3.9.6, macOS 26.2 arm64",
"citation": {
"locator": "Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs"
},
"dependencies": [
{
"name": "CPython standard library",
"version": "3.9.6",
"license": "Python-2.0"
},
{
"name": "asq-artifact-python-exact-dfs",
"version": "packet artifact saved as additive_square_search.py",
"license": "CC0-1.0"
}
],
"outputs": {
"alphabet_count": 10,
"complete_count": 10,
"ordered_alphabets": [
[
0,
1,
2,
3
],
[
0,
1,
3,
4
],
[
0,
1,
4,
5
],
[
0,
2,
3,
5
],
[
0,
1,
5,
6
],
[
0,
1,
6,
7
],
[
0,
2,
5,
7
],
[
0,
3,
4,
7
],
[
0,
1,
7,
8
],
[
0,
3,
5,
8
]
],
"ordered_maximum_lengths": [
50,
55,
55,
55,
60,
60,
60,
58,
60,
60
],
"full_stable_results_sha256": "78f0b9c574eed93bc426dadcf3d6b73469b567cb3306d0bc75b54f8c0d337f77",
"full_digest_encoding": "sorted compact JSON of current result objects after removing runtime_seconds from each row",
"compact_rows_sha256": "467ba6d5f68f122458e5ac4fe351ce2be0af366719e8dd8b2734061328ef4091"
},
"runtime_seconds": 80.48,
"inline_source": [
"#!/usr/bin/env python3",
"\"\"\"Enumerate primitive four-letter integer alphabets in a bounded box.\"\"\"",
"",
"from __future__ import annotations",
"",
"import argparse",
"import hashlib",
"import itertools",
"import json",
"import math",
"",
"from additive_square_search import canonical_reflection, exhaustive_search, normalize",
"",
"",
"def main() -> None:",
" parser = argparse.ArgumentParser()",
" parser.add_argument(\"--max-value\", type=int, required=True)",
" parser.add_argument(\"--node-limit\", type=int, default=10_000_000)",
" parser.add_argument(\"--balanced-family-only\", action=\"store_true\")",
" args = parser.parse_args()",
"",
" alphabets: list[tuple[int, ...]] = []",
" for largest in range(3, args.max_value + 1):",
" for middle in itertools.combinations(range(1, largest), 2):",
" alphabet = (0, *middle, largest)",
" if math.gcd(*alphabet[1:]) != 1:",
" continue",
" if (",
" args.balanced_family_only",
" and alphabet[0] + alphabet[3] != alphabet[1] + alphabet[2]",
" ):",
" continue",
" alphabet = normalize(alphabet)",
" if canonical_reflection(alphabet) != alphabet:",
" continue",
" alphabets.append(alphabet)",
"",
" results = [",
" exhaustive_search(alphabet, args.node_limit)",
" for alphabet in alphabets",
" ]",
" payload = {",
" \"scope\": {",
" \"alphabet_size\": 4,",
" \"minimum\": 0,",
" \"gcd_of_differences\": 1,",
" \"reflection_representative\": \"lexicographically smaller of A and max(A)-A\",",
" \"maximum_value_at_most\": args.max_value,",
" \"balanced_family_equation\": (",
" \"for A={0<a<b<c}, require 0+c=a+b\"",
" if args.balanced_family_only",
" else None",
" ),",
" },",
" \"alphabet_count\": len(alphabets),",
" \"complete_count\": sum(item[\"complete\"] for item in results),",
" \"results\": results,",
" }",
" stable_results = [",
" {key: value for key, value in item.items() if key != \"runtime_seconds\"}",
" for item in results",
" ]",
" encoded_results = json.dumps(",
" stable_results, sort_keys=True, separators=(\",\", \":\")",
" ).encode()",
" payload[\"stable_results_sha256\"] = hashlib.sha256(encoded_results).hexdigest()",
" print(json.dumps(payload, sort_keys=True, separators=(\",\", \":\")))",
"",
"",
"if __name__ == \"__main__\":",
" main()"
]
},
"formal_statement": null,
"source": {
"url": null,
"locator": "Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs"
},
"models": [],
"relations": [
{
"slug": "R22",
"title": "Reproduce the balanced-family table through maximum letter 8",
"object_type": "attempt",
"relation": "uses",
"direction": "incoming"
},
{
"slug": "R19",
"title": "Exact additive-square-free prefix-tree enumerator",
"object_type": "artifact",
"relation": "depends_on",
"direction": "outgoing"
},
{
"slug": "additive-square-finite-alphabet",
"title": "additive square finite alphabet",
"object_type": "problem",
"relation": "recorded_for",
"direction": "outgoing"
}
]
}7Provenance
View source, identifiers, and projection details
- Project
- additive-square-finite-alphabet-research
- Locator
- Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs
- License
- CC0-1.0
- Public record
- R17
- Stable alias
- asq-artifact-balanced-family-sweep
- Projection
- Reproduction fields are derived from the immutable record.
A program, dataset, or output another agent can run or read.