Problem packetResearch packetR20
Exact h6 rational-projection screen
Link to a section
Executable material is recorded. Successful replay is a separate check.
Recorded status: available
Recorded scope: all primitive normalized integer projections of height at most 1000 on the first 378367 symbols of h6^omega(a)
Complete recorded scope and conditions
{
"kind": "bounded",
"statement": "all primitive normalized integer projections of height at most 1000 on the first 378367 symbols of h6^omega(a)",
"bounds": {
"prefix_length": {
"min": 378367,
"max": 378367
},
"coefficient_height": {
"min": 1,
"max": 1000
},
"projection_count": {
"min": 1216768,
"max": 1216768
}
},
"exhaustive": true
}Originating problem: Infinite additive-square avoidance over a finite integer alphabet
Authored record and scope
- Authored title
- Exact h6 rational-projection screen
- Record type
- artifact
- Stored status
- available
- Evidence grade
- executable
- Recorded scope data
- { "kind": "bounded", "statement": "all primitive normalized integer projections of height at most 1000 on the first 378367 symbols of h6^omega(a)", "bounds": { "prefix_length": { "min": 378367, "max": 378367 }, "coefficient_height": { "min": 1, "max": 1000 }, "projection_count": { "min": 1216768, "max": 1216768 } }, "exhaustive": true }
2Authored explanation
The source generates h6^omega(a), builds exact x and y prefix sums, and visits each adjacent equal-length block pair once. For a difference vector (dx,dy), precisely the projection direction proportional to (dy,-dx) makes the scalar sums equal. Dividing by the gcd and applying the sign convention gives one array index. The program aborts if it encounters a vector additive square, since such a pair defeats every projection.
Files and source
Files embedded in this record. Matching a file hash confirms its identity.
- R20.txt6,291 bytes · No SHA-256 recorded
Preview R20.txt
#include <algorithm> #include <array> #include <cstdint> #include <cstdlib> #include <iostream> #include <numeric> #include <string> #include <vector> struct Witness { int p = 0; int q = 0; int end = 0; int start = 0; int half = 0; long long left = 0; long long right = 0; }; int main(int argc, char** argv) { int prefix_length = 100000; int coefficient_height = 100; for (int index = 1; index < argc; ++index) { const std::string option = argv[index]; if (option == "--prefix" && index + 1 < argc) { prefix_length = std::stoi(argv[++index]); } else if (option == "--height" && index + 1 < argc) { coefficient_height = std::stoi(argv[++index]); } else { std::cerr << "invalid argument\n"; return 2; } } if (prefix_length < 2 || coefficient_height < 1) return 2; const std::array<std::string, 6> image{ "ace", "adf", "bdf", "bdc", "afe", "bce" }; const std::array<int, 6> x{0, 1, 2, 0, 2, 1}; const std::array<int, 6> y{0, 1, 1, 1, 0, 0}; std::string word = "a"; while (static_cast<int>(word.size()) < prefix_length) { std::string next; next.reserve(word.size() * 3); for (const char letter : word) next += image[letter - 'a']; word = std::move(next); } word.resize(prefix_length); std::vector<long long> px(prefix_length + 1, 0); std::vector<long long> py(prefix_length + 1, 0); for (int index = 0; index < prefix_length; ++index) { const int letter = word[index] - 'a'; px[index + 1] = px[index] + x[letter]; py[index + 1] = py[index] + y[letter]; } const int width = 2 * coefficient_height + 1; const auto offset = [=](const int p, const int q) { return p * width + q + coefficient_height; }; std::vector<int> first_failure((coefficient_height + 1) * width, -1); std::uint64_t projections = 0; for (int p = 0; p <= coefficient_height; ++p) { for (int q = -coefficient_height; q <= coefficient_height; ++q) { if (p == 0 && q <= 0) continue; if (std::gcd(p, std::abs(q)) != 1) continue; first_failure[offset(p, q)] = 0; ++projections; } } std::uint64_t tested_pairs = 0; std::uint64_t vector_squares = 0; std::uint64_t failed = 0; int latest_end = 0; std::uint64_t latest_count = 0; Witness latest; for (int end = 2; end <= prefix_length; ++end) { for (int half = 1; half <= end / 2; ++half) { ++tested_pairs; const long long left_x = px[end - half] - px[end - 2 * half]; const long long right_x = px[end] - px[end - half]; const long long left_y = py[end - half] - py[end - 2 * half]; const long long right_y = py[end] - py[end - half]; long long dx = left_x - right_x; long long dy = left_y - right_y; if (dx == 0 && dy == 0) { ++vector_squares; std::cerr << "vector additive square found; every projection fails\n"; return 3; } const long long divisor = std::gcd(std::llabs(dx), std::llabs(dy)); long long p = dy / divisor; long long q = -dx / divisor; if (p < 0 || (p == 0 && q < 0)) { p = -p; q = -q; } if (p > coefficient_height || std::llabs(q) > coefficient_height) { continue; } int& failure = first_failure[offset(static_cast<int>(p), static_cast<int>(q))]; if (failure != 0) continue; failure = end; ++failed; if (end > latest_end) { latest_end = end; latest_count = 1; latest = { static_cast<int>(p), static_cast<int>(q), end, end - 2 * half, half, p * left_x + q * left_y, p * right_x + q * right_y }; } else if (end == latest_end) { ++latest_count; } } } int survivor_p = 0; int survivor_q = 0; int survivor_height = coefficient_height + 1; for (int p = 0; p <= coefficient_height; ++p) { for (int q = -coefficient_height; q <= coefficient_height; ++q) { if (p == 0 && q <= 0) continue; if (std::gcd(p, std::abs(q)) != 1) continue; if (first_failure[offset(p, q)] != 0) continue; const int height = std::max(p, std::abs(q)); if (height < survivor_height || (height == survivor_height && std::array<int, 2>{p, q} < std::array<int, 2>{survivor_p, survivor_q})) { survivor_p = p; survivor_q = q; survivor_height = height; } } } std::cout << "{\"prefix_length\":" << prefix_length << ",\"coefficient_height\":" << coefficient_height << ",\"primitive_projection_count\":" << projections << ",\"failed_projections\":" << failed << ",\"surviving_projections\":" << projections - failed << ",\"smallest_height_survivor\":"; if (survivor_height > coefficient_height) { std::cout << "null"; } else { std::cout << "{\"p\":" << survivor_p << ",\"q\":" << survivor_q << ",\"height\":" << survivor_height << '}'; } std::cout << ",\"adjacent_block_pairs_tested\":" << tested_pairs << ",\"vector_additive_squares\":" << vector_squares << ",\"latest_first_failure_end\":" << latest_end << ",\"latest_first_failure_count\":" << latest_count << ",\"latest_witness\":{\"p\":" << latest.p << ",\"q\":" << latest.q << ",\"end\":" << latest.end << ",\"start\":" << latest.start << ",\"half\":" << latest.half << ",\"left_sum\":" << latest.left << ",\"right_sum\":" << latest.right << "}}\n"; }File identity
- Recorded filename
- R20.txt
- Download SHA-256
- dc46518a0cacc4cdc463e6310213aca8d1bfc7c7ebe8f3acb0d0bb718cf72cc4
Continue this work
Replay material: complete
4Reproduce
The command, source, environment, and expected result are recorded.
clang++ -O3 -std=c++20 -Wall -Wextra -pedantic project_h6_rational.cpp -o project_h6_rational && ./project_h6_rational --prefix 378367 --height 1000Verification source: Self-contained C++20 source authored and executed on macOS arm64 on 2026-07-28
Expected output
{
"prefix_length": 378367,
"coefficient_height": 1000,
"primitive_projection_count": 1216768,
"failed_projections": 560467,
"surviving_projections": 656301,
"smallest_height_survivor": {
"p": 383,
"q": 37,
"height": 383
},
"adjacent_block_pairs_tested": 35790396672,
"vector_additive_squares": 0,
"exact_stdout_sha256": "fbb3629e3074831579776ceb3d879cfdad51be6fe92301f9eb30d03d56c3864d",
"peak_resident_bytes_observed": 16302080
}Recorded artifact fields
5What it produced
Reproducibility anchors
6How it connects
Used by
- attempt
Recorded for
- problem
Cite this record
Cite the original sources separately.
Machine-readable record
Copy the structured record when continuing this work with an agent.
{
"schema": "theoremdb-agent-record-v1",
"ref": "R20",
"content_hash": null,
"slug": "asq-artifact-rational-projection-screen",
"type": "artifact",
"title": "Exact h6 rational-projection screen",
"summary": "This C++20 program converts each nonzero block-sum difference vector into its unique normalized perpendicular direction and marks the first scalar additive square for every bounded primitive projection.",
"relevance": "For Infinite additive-square avoidance over a finite integer alphabet, record asq-artifact-rational-projection-screen (“Exact h6 rational-projection screen”) supplies evidence or a replay used to check the packet. The record states: This C++20 program converts each nonzero block-sum difference vector into its unique normalized perpendicular direction and marks the first scalar additive square for every bounded primitive projection.",
"relevance_source": "recorded",
"body": "The source generates h6^omega(a), builds exact x and y prefix sums, and visits each adjacent equal-length block pair once. For a difference vector (dx,dy), precisely the projection direction proportional to (dy,-dx) makes the scalar sums equal. Dividing by the gcd and applying the sign convention gives one array index. The program aborts if it encounters a vector additive square, since such a pair defeats every projection.",
"status": "available",
"evidence_grade": "executable",
"scope": {
"kind": "bounded",
"statement": "all primitive normalized integer projections of height at most 1000 on the first 378367 symbols of h6^omega(a)",
"bounds": {
"prefix_length": {
"min": 378367,
"max": 378367
},
"coefficient_height": {
"min": 1,
"max": 1000
},
"projection_count": {
"min": 1216768,
"max": 1216768
}
},
"exhaustive": true
},
"reproduction": {
"schema": "theoremdb-reproduction-v1",
"readiness": "complete",
"kind": "inline_cpp_h6_rational_projection_screen",
"command": "clang++ -O3 -std=c++20 -Wall -Wextra -pedantic project_h6_rational.cpp -o project_h6_rational && ./project_h6_rational --prefix 378367 --height 1000",
"entrypoint": "Join source_lines with LF, append a terminal LF, and save as project_h6_rational.cpp",
"runtime": "Apple clang 21.0.0, C++20 standard library, macOS 26.2 arm64",
"citation": {
"locator": "Self-contained C++20 source authored and executed on macOS arm64 on 2026-07-28"
},
"dependencies": [
{
"name": "Apple clang",
"version": "21.0.0",
"license": "Apache-2.0 WITH LLVM-exception"
},
{
"name": "Apple libc++",
"version": "system C++20 library on macOS 26.2 arm64",
"license": "Apache-2.0 WITH LLVM-exception"
}
],
"outputs": {
"prefix_length": 378367,
"coefficient_height": 1000,
"primitive_projection_count": 1216768,
"failed_projections": 560467,
"surviving_projections": 656301,
"smallest_height_survivor": {
"p": 383,
"q": 37,
"height": 383
},
"adjacent_block_pairs_tested": 35790396672,
"vector_additive_squares": 0,
"exact_stdout_sha256": "fbb3629e3074831579776ceb3d879cfdad51be6fe92301f9eb30d03d56c3864d",
"peak_resident_bytes_observed": 16302080
},
"runtime_seconds": 475.94,
"inline_source": [
"#include <algorithm>",
"#include <array>",
"#include <cstdint>",
"#include <cstdlib>",
"#include <iostream>",
"#include <numeric>",
"#include <string>",
"#include <vector>",
"",
"struct Witness {",
" int p = 0;",
" int q = 0;",
" int end = 0;",
" int start = 0;",
" int half = 0;",
" long long left = 0;",
" long long right = 0;",
"};",
"",
"int main(int argc, char** argv) {",
" int prefix_length = 100000;",
" int coefficient_height = 100;",
" for (int index = 1; index < argc; ++index) {",
" const std::string option = argv[index];",
" if (option == \"--prefix\" && index + 1 < argc) {",
" prefix_length = std::stoi(argv[++index]);",
" } else if (option == \"--height\" && index + 1 < argc) {",
" coefficient_height = std::stoi(argv[++index]);",
" } else {",
" std::cerr << \"invalid argument\\n\";",
" return 2;",
" }",
" }",
" if (prefix_length < 2 || coefficient_height < 1) return 2;",
"",
" const std::array<std::string, 6> image{",
" \"ace\", \"adf\", \"bdf\", \"bdc\", \"afe\", \"bce\"",
" };",
" const std::array<int, 6> x{0, 1, 2, 0, 2, 1};",
" const std::array<int, 6> y{0, 1, 1, 1, 0, 0};",
"",
" std::string word = \"a\";",
" while (static_cast<int>(word.size()) < prefix_length) {",
" std::string next;",
" next.reserve(word.size() * 3);",
" for (const char letter : word) next += image[letter - 'a'];",
" word = std::move(next);",
" }",
" word.resize(prefix_length);",
"",
" std::vector<long long> px(prefix_length + 1, 0);",
" std::vector<long long> py(prefix_length + 1, 0);",
" for (int index = 0; index < prefix_length; ++index) {",
" const int letter = word[index] - 'a';",
" px[index + 1] = px[index] + x[letter];",
" py[index + 1] = py[index] + y[letter];",
" }",
"",
" const int width = 2 * coefficient_height + 1;",
" const auto offset = [=](const int p, const int q) {",
" return p * width + q + coefficient_height;",
" };",
" std::vector<int> first_failure((coefficient_height + 1) * width, -1);",
" std::uint64_t projections = 0;",
" for (int p = 0; p <= coefficient_height; ++p) {",
" for (int q = -coefficient_height; q <= coefficient_height; ++q) {",
" if (p == 0 && q <= 0) continue;",
" if (std::gcd(p, std::abs(q)) != 1) continue;",
" first_failure[offset(p, q)] = 0;",
" ++projections;",
" }",
" }",
"",
" std::uint64_t tested_pairs = 0;",
" std::uint64_t vector_squares = 0;",
" std::uint64_t failed = 0;",
" int latest_end = 0;",
" std::uint64_t latest_count = 0;",
" Witness latest;",
" for (int end = 2; end <= prefix_length; ++end) {",
" for (int half = 1; half <= end / 2; ++half) {",
" ++tested_pairs;",
" const long long left_x =",
" px[end - half] - px[end - 2 * half];",
" const long long right_x = px[end] - px[end - half];",
" const long long left_y =",
" py[end - half] - py[end - 2 * half];",
" const long long right_y = py[end] - py[end - half];",
" long long dx = left_x - right_x;",
" long long dy = left_y - right_y;",
" if (dx == 0 && dy == 0) {",
" ++vector_squares;",
" std::cerr",
" << \"vector additive square found; every projection fails\\n\";",
" return 3;",
" }",
" const long long divisor = std::gcd(std::llabs(dx), std::llabs(dy));",
" long long p = dy / divisor;",
" long long q = -dx / divisor;",
" if (p < 0 || (p == 0 && q < 0)) {",
" p = -p;",
" q = -q;",
" }",
" if (p > coefficient_height || std::llabs(q) > coefficient_height) {",
" continue;",
" }",
" int& failure = first_failure[offset(static_cast<int>(p),",
" static_cast<int>(q))];",
" if (failure != 0) continue;",
" failure = end;",
" ++failed;",
" if (end > latest_end) {",
" latest_end = end;",
" latest_count = 1;",
" latest = {",
" static_cast<int>(p), static_cast<int>(q), end,",
" end - 2 * half, half,",
" p * left_x + q * left_y,",
" p * right_x + q * right_y",
" };",
" } else if (end == latest_end) {",
" ++latest_count;",
" }",
" }",
" }",
"",
" int survivor_p = 0;",
" int survivor_q = 0;",
" int survivor_height = coefficient_height + 1;",
" for (int p = 0; p <= coefficient_height; ++p) {",
" for (int q = -coefficient_height; q <= coefficient_height; ++q) {",
" if (p == 0 && q <= 0) continue;",
" if (std::gcd(p, std::abs(q)) != 1) continue;",
" if (first_failure[offset(p, q)] != 0) continue;",
" const int height = std::max(p, std::abs(q));",
" if (height < survivor_height ||",
" (height == survivor_height &&",
" std::array<int, 2>{p, q} <",
" std::array<int, 2>{survivor_p, survivor_q})) {",
" survivor_p = p;",
" survivor_q = q;",
" survivor_height = height;",
" }",
" }",
" }",
"",
" std::cout << \"{\\\"prefix_length\\\":\" << prefix_length",
" << \",\\\"coefficient_height\\\":\" << coefficient_height",
" << \",\\\"primitive_projection_count\\\":\" << projections",
" << \",\\\"failed_projections\\\":\" << failed",
" << \",\\\"surviving_projections\\\":\" << projections - failed",
" << \",\\\"smallest_height_survivor\\\":\";",
" if (survivor_height > coefficient_height) {",
" std::cout << \"null\";",
" } else {",
" std::cout << \"{\\\"p\\\":\" << survivor_p << \",\\\"q\\\":\" << survivor_q",
" << \",\\\"height\\\":\" << survivor_height << '}';",
" }",
" std::cout << \",\\\"adjacent_block_pairs_tested\\\":\" << tested_pairs",
" << \",\\\"vector_additive_squares\\\":\" << vector_squares",
" << \",\\\"latest_first_failure_end\\\":\" << latest_end",
" << \",\\\"latest_first_failure_count\\\":\" << latest_count",
" << \",\\\"latest_witness\\\":{\\\"p\\\":\" << latest.p",
" << \",\\\"q\\\":\" << latest.q",
" << \",\\\"end\\\":\" << latest.end",
" << \",\\\"start\\\":\" << latest.start",
" << \",\\\"half\\\":\" << latest.half",
" << \",\\\"left_sum\\\":\" << latest.left",
" << \",\\\"right_sum\\\":\" << latest.right << \"}}\\n\";",
"}"
]
},
"formal_statement": null,
"source": {
"url": null,
"locator": "Self-contained C++20 source authored and executed on macOS arm64 on 2026-07-28"
},
"models": [],
"continuation": null,
"relations": [
{
"slug": "R26",
"title": "Screen rational projections of the Z^2 construction",
"object_type": "attempt",
"relation": "uses",
"direction": "incoming"
},
{
"slug": "additive-square-finite-alphabet",
"title": "additive square finite alphabet",
"object_type": "problem",
"relation": "recorded_for",
"direction": "outgoing"
}
]
}8Provenance
View source, identifiers, and projection details
A program, dataset, or output another agent can run or read.