Problem packetResearch packetR127
Packed-factor restricted-growth replay
Link to a section
Executable material is recorded. Successful replay is a separate check.
Recorded status: available
Recorded scope: every finite word of lengths 1 through 14, modulo global alphabet renaming
Complete recorded scope and conditions
{
"kind": "bounded",
"statement": "every finite word of lengths 1 through 14, modulo global alphabet renaming",
"bounds": {
"word_length": {
"min": 1,
"max": 14
},
"alphabet_size": {
"min": 1,
"max": 14
}
},
"exhaustive": true
}Originating problem: The three-halves bound for distinct squares in circular words
Recorded relationships: Exact maxima for every alphabet through length fourteen
Authored record and scope
- Authored title
- Packed-factor restricted-growth replay
- Record type
- artifact
- Stored status
- available
- Evidence grade
- executable
- Recorded scope data
- { "kind": "bounded", "statement": "every finite word of lengths 1 through 14, modulo global alphabet renaming", "bounds": { "word_length": { "min": 1, "max": 14 }, "alphabet_size": { "min": 1, "max": 14 } }, "exhaustive": true }
- Linked research record IDs
- R133
2Authored explanation
The program recursively generates restricted-growth strings. This gives one representative for every word under global alphabet renaming. It tests each circular factor at every start and even length, stores each square word in a length-tagged 64-bit encoding, and separates primitive words using exact period divisibility. The largest layer contains Bell(14)=190,899,322 strings. The run uses exact comparisons and no random choices.
Files and source
Files embedded in this record. Matching a file hash confirms its identity.
- R127.txt3,902 bytes · No SHA-256 recorded
Preview R127.txt
#include <algorithm> #include <cstdint> #include <iostream> #include <set> #include <sstream> #include <string> #include <unordered_set> #include <vector> struct Row { unsigned long long generated = 0; int maximum = -1; unsigned long long maximizers = 0; std::vector<int> first; int primitive_maximum = -1; std::vector<int> primitive_first; int nonprimitive_maximum = -1; std::vector<int> nonprimitive_first; }; static int square_count(const std::vector<int>& word) { const int n = static_cast<int>(word.size()); std::vector<int> doubled(word); doubled.insert(doubled.end(), word.begin(), word.end()); std::unordered_set<std::uint64_t> squares; for (int start = 0; start < n; ++start) { for (int half = 1; 2 * half <= n; ++half) { bool square = true; for (int j = 0; j < half; ++j) { if (doubled[start + j] != doubled[start + half + j]) { square = false; break; } } if (!square) continue; const int length = 2 * half; std::uint64_t packed = static_cast<std::uint64_t>(length) << 56; for (int j = 0; j < length; ++j) { packed |= static_cast<std::uint64_t>(doubled[start + j]) << (4 * (length - 1 - j)); } squares.insert(packed); } } return static_cast<int>(squares.size()); } static bool is_primitive(const std::vector<int>& word) { const int n = static_cast<int>(word.size()); for (int period = 1; period < n; ++period) { if (n % period != 0) continue; bool repeats = true; for (int i = period; i < n; ++i) { if (word[i] != word[i % period]) { repeats = false; break; } } if (repeats) return false; } return true; } static void visit(std::vector<int>& word, int position, int maximum, Row& row) { const int n = static_cast<int>(word.size()); if (position == n) { ++row.generated; const int count = square_count(word); if (count > row.maximum) { row.maximum = count; row.maximizers = 1; row.first = word; } else if (count == row.maximum) { ++row.maximizers; } if (is_primitive(word) && count > row.primitive_maximum) { row.primitive_maximum = count; row.primitive_first = word; } if (!is_primitive(word) && count > row.nonprimitive_maximum) { row.nonprimitive_maximum = count; row.nonprimitive_first = word; } return; } for (int letter = 0; letter <= maximum + 1; ++letter) { word[position] = letter; visit(word, position + 1, std::max(maximum, letter), row); } } static std::string render(const std::vector<int>& word) { std::ostringstream out; for (int letter : word) out << letter; return out.str(); } int main(int argc, char** argv) { if (argc != 2) { std::cerr << "usage: circular_squares_replay MAX_N\n"; return 2; } const int max_n = std::stoi(argv[1]); for (int n = 1; n <= max_n; ++n) { Row row; std::vector<int> word(n, 0); visit(word, 1, 0, row); std::cout << "n=" << n << " rgs=" << row.generated << " max=" << row.maximum << " rgs_maximizers=" << row.maximizers << " first=" << render(row.first) << " primitive_max=" << row.primitive_maximum << " primitive_first=" << render(row.primitive_first) << " nonprimitive_max=" << row.nonprimitive_maximum << " nonprimitive_first=" << render(row.nonprimitive_first) << "\n"; } }File identity
- Recorded filename
- R127.txt
- Download SHA-256
- 221e7560135efe5bfc85fd882691dd1347a418bc7daf2baf5e2966c92e7edd55
Continue this work
Replay material: complete
4Reproduce
The command, source, environment, and expected result are recorded.
clang++ -O3 -std=c++17 -Wall -Wextra -pedantic circular_squares_replay.cpp -o circular_squares_replay && /usr/bin/time -l ./circular_squares_replay 14Verification source: Self-contained C++17 source executed on macOS arm64 on 2026-07-28
Expected output
{
"raw_stdout_sha256": "ff8e665c674ad476c5ecdd63e8418f39cff533478523e23cddd633aac8482e4c",
"normalized_stdout_sha256": "05522d1ef84a3ea39ee9160a4fca1717d1e1a494c2d8b99eaf5f786603f7f717",
"exact_maxima": [
0,
1,
1,
2,
3,
4,
4,
6,
6,
9,
8,
10,
11,
13
],
"primitive_maxima": [
0,
0,
1,
2,
3,
3,
4,
6,
6,
7,
8,
10,
11,
11
],
"nonprimitive_maxima": [
null,
1,
1,
2,
2,
4,
3,
6,
4,
9,
5,
9,
6,
13
],
"restricted_growth_counts": [
1,
2,
5,
15,
52,
203,
877,
4140,
21147,
115975,
678570,
4213597,
27644437,
190899322
],
"peak_resident_bytes_observed": 1441792
}Recorded artifact fields
5What it produced
6How it connects
Evidence for
- claim
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": "R127",
"content_hash": null,
"slug": "cds-artifact-rgs-packed-replay",
"type": "artifact",
"title": "Packed-factor restricted-growth replay",
"summary": "A complete C++17 program checks every alphabet-renaming class through length 14 and reports total, primitive, and nonprimitive maxima.",
"relevance": "For The three-halves bound for distinct squares in circular words, record cds-artifact-rgs-packed-replay (“Packed-factor restricted-growth replay”) supplies evidence or a replay used to check the packet. The record states: A complete C++17 program checks every alphabet-renaming class through length 14 and reports total, primitive, and nonprimitive maxima.",
"relevance_source": "recorded",
"body": "The program recursively generates restricted-growth strings. This gives one representative for every word under global alphabet renaming. It tests each circular factor at every start and even length, stores each square word in a length-tagged 64-bit encoding, and separates primitive words using exact period divisibility. The largest layer contains Bell(14)=190,899,322 strings. The run uses exact comparisons and no random choices.",
"status": "available",
"evidence_grade": "executable",
"scope": {
"kind": "bounded",
"statement": "every finite word of lengths 1 through 14, modulo global alphabet renaming",
"bounds": {
"word_length": {
"min": 1,
"max": 14
},
"alphabet_size": {
"min": 1,
"max": 14
}
},
"exhaustive": true
},
"reproduction": {
"schema": "theoremdb-reproduction-v1",
"readiness": "complete",
"kind": "inline_cpp_exhaustive_enumerator",
"command": "clang++ -O3 -std=c++17 -Wall -Wextra -pedantic circular_squares_replay.cpp -o circular_squares_replay && /usr/bin/time -l ./circular_squares_replay 14",
"entrypoint": "Join source_lines with LF characters, append a final LF, and save as circular_squares_replay.cpp",
"runtime": "Apple clang 21.0.0, C++17 standard library, macOS 26.2 arm64",
"citation": {
"locator": "Self-contained C++17 source executed on macOS arm64 on 2026-07-28"
},
"dependencies": [
{
"name": "Apple clang and libc++",
"version": "21.0.0",
"license": "Apache-2.0 WITH LLVM-exception"
}
],
"outputs": {
"raw_stdout_sha256": "ff8e665c674ad476c5ecdd63e8418f39cff533478523e23cddd633aac8482e4c",
"normalized_stdout_sha256": "05522d1ef84a3ea39ee9160a4fca1717d1e1a494c2d8b99eaf5f786603f7f717",
"exact_maxima": [
0,
1,
1,
2,
3,
4,
4,
6,
6,
9,
8,
10,
11,
13
],
"primitive_maxima": [
0,
0,
1,
2,
3,
3,
4,
6,
6,
7,
8,
10,
11,
11
],
"nonprimitive_maxima": [
null,
1,
1,
2,
2,
4,
3,
6,
4,
9,
5,
9,
6,
13
],
"restricted_growth_counts": [
1,
2,
5,
15,
52,
203,
877,
4140,
21147,
115975,
678570,
4213597,
27644437,
190899322
],
"peak_resident_bytes_observed": 1441792
},
"runtime_seconds": 76,
"inline_source": [
"#include <algorithm>",
"#include <cstdint>",
"#include <iostream>",
"#include <set>",
"#include <sstream>",
"#include <string>",
"#include <unordered_set>",
"#include <vector>",
"",
"struct Row {",
" unsigned long long generated = 0;",
" int maximum = -1;",
" unsigned long long maximizers = 0;",
" std::vector<int> first;",
" int primitive_maximum = -1;",
" std::vector<int> primitive_first;",
" int nonprimitive_maximum = -1;",
" std::vector<int> nonprimitive_first;",
"};",
"",
"static int square_count(const std::vector<int>& word) {",
" const int n = static_cast<int>(word.size());",
" std::vector<int> doubled(word);",
" doubled.insert(doubled.end(), word.begin(), word.end());",
" std::unordered_set<std::uint64_t> squares;",
" for (int start = 0; start < n; ++start) {",
" for (int half = 1; 2 * half <= n; ++half) {",
" bool square = true;",
" for (int j = 0; j < half; ++j) {",
" if (doubled[start + j] != doubled[start + half + j]) {",
" square = false;",
" break;",
" }",
" }",
" if (!square) continue;",
" const int length = 2 * half;",
" std::uint64_t packed = static_cast<std::uint64_t>(length) << 56;",
" for (int j = 0; j < length; ++j) {",
" packed |= static_cast<std::uint64_t>(doubled[start + j])",
" << (4 * (length - 1 - j));",
" }",
" squares.insert(packed);",
" }",
" }",
" return static_cast<int>(squares.size());",
"}",
"",
"static bool is_primitive(const std::vector<int>& word) {",
" const int n = static_cast<int>(word.size());",
" for (int period = 1; period < n; ++period) {",
" if (n % period != 0) continue;",
" bool repeats = true;",
" for (int i = period; i < n; ++i) {",
" if (word[i] != word[i % period]) {",
" repeats = false;",
" break;",
" }",
" }",
" if (repeats) return false;",
" }",
" return true;",
"}",
"",
"static void visit(std::vector<int>& word, int position, int maximum, Row& row) {",
" const int n = static_cast<int>(word.size());",
" if (position == n) {",
" ++row.generated;",
" const int count = square_count(word);",
" if (count > row.maximum) {",
" row.maximum = count;",
" row.maximizers = 1;",
" row.first = word;",
" } else if (count == row.maximum) {",
" ++row.maximizers;",
" }",
" if (is_primitive(word) && count > row.primitive_maximum) {",
" row.primitive_maximum = count;",
" row.primitive_first = word;",
" }",
" if (!is_primitive(word) && count > row.nonprimitive_maximum) {",
" row.nonprimitive_maximum = count;",
" row.nonprimitive_first = word;",
" }",
" return;",
" }",
" for (int letter = 0; letter <= maximum + 1; ++letter) {",
" word[position] = letter;",
" visit(word, position + 1, std::max(maximum, letter), row);",
" }",
"}",
"",
"static std::string render(const std::vector<int>& word) {",
" std::ostringstream out;",
" for (int letter : word) out << letter;",
" return out.str();",
"}",
"",
"int main(int argc, char** argv) {",
" if (argc != 2) {",
" std::cerr << \"usage: circular_squares_replay MAX_N\\n\";",
" return 2;",
" }",
" const int max_n = std::stoi(argv[1]);",
" for (int n = 1; n <= max_n; ++n) {",
" Row row;",
" std::vector<int> word(n, 0);",
" visit(word, 1, 0, row);",
" std::cout << \"n=\" << n",
" << \" rgs=\" << row.generated",
" << \" max=\" << row.maximum",
" << \" rgs_maximizers=\" << row.maximizers",
" << \" first=\" << render(row.first)",
" << \" primitive_max=\" << row.primitive_maximum",
" << \" primitive_first=\" << render(row.primitive_first)",
" << \" nonprimitive_max=\" << row.nonprimitive_maximum",
" << \" nonprimitive_first=\" << render(row.nonprimitive_first)",
" << \"\\n\";",
" }",
"}"
]
},
"formal_statement": null,
"source": {
"url": null,
"locator": "Self-contained C++17 source executed on macOS arm64 on 2026-07-28"
},
"models": [],
"continuation": null,
"relations": [
{
"slug": "R133",
"title": "Exact maxima for every alphabet through length fourteen",
"object_type": "claim",
"relation": "evidences",
"direction": "outgoing"
},
{
"slug": "circular-distinct-squares-three-halves",
"title": "circular distinct squares three halves",
"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.