TheoremDB

Problem packetResearch packetR440

R440Executable evidence

Bit-packed cycle detection and direct replay certificate

View replayOpen source ↗
Link to a section

Authored summary

A self-contained C program runs Floyd detection and a full 64,165,598-step replay over exact 57-bit states.

Executable material is recorded. Successful replay is a separate check.

Recorded status: available

Recorded scope: every state in the complete orbit of the stated 7 by 7 all-white initial condition through its first return

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "every state in the complete orbit of the stated 7 by 7 all-white initial condition through its first return",
  "bounds": {
    "first_step": {
      "min": 0,
      "max": 0
    },
    "last_step": {
      "min": 64165598,
      "max": 64165598
    }
  },
  "exhaustive": true
}

Originating problem: First recurrence of Langton's ant on the 7 by 7 torus

Recorded relationships: The complete initial state first returns after 64,165,598 updates

Authored record and scope
Authored title
Bit-packed cycle detection and direct replay certificate
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "every state in the complete orbit of the stated 7 by 7 all-white initial condition through its first return", "bounds": { "first_step": { "min": 0, "max": 0 }, "last_step": { "min": 64165598, "max": 64165598 } }, "exhaustive": true }
Linked research record IDs
R442

2Authored explanation

The replay hashes the little-endian eight-byte encoding of each state at times 0 through 64,165,597 with standard 64-bit FNV-1a. The digest is `981fc1e057236ac9`. The final packed state is `0000000000000000`.

Selected packed-state checkpoints are \[ \begin{array}{r|c} 1&0082000000000001\\ 10&011b040000000183\\ 100&0022a15941424494\\ 1000&015359d5f9766cb9\\ 1000000&0161407e02511400\\ 3000000&002edbee6e815e65\\ 10000000&00179517efcf3c12\\ 64165597&008e000000000080\\ 64165598&0000000000000000 \end{array} \] The canonical stdout line, including its terminating line feed, has SHA-256 digest `e78091b2d9b11ecd5126acd78067e4efc1397f09aa1ee18c5afe50eb2c0a75f6`. A reproduced optimized run took about two seconds.

Files and source

Files embedded in this record. Matching a file hash confirms its identity.

  • R440.txt1,875 bytes · No SHA-256 recorded
    Preview R440.txt
    #include <assert.h>
    #include <inttypes.h>
    #include <stdint.h>
    #include <stdio.h>
    #define N 7u
    #define PERIOD UINT64_C(64165598)
    #define COLOR_MASK ((UINT64_C(1)<<49)-1)
    static inline uint64_t step(uint64_t state) {
      uint64_t colors=state&COLOR_MASK;
      unsigned pos=(unsigned)((state>>49)&63u);
      unsigned dir=(unsigned)((state>>55)&3u);
      unsigned black=(unsigned)((colors>>pos)&1u);
      colors^=UINT64_C(1)<<pos;
      dir=black ? ((dir+3u)&3u) : ((dir+1u)&3u);
      unsigned x=pos%N, y=pos/N;
      if (dir==0) y=(y+N-1)%N;
      else if (dir==1) x=(x+1)%N;
      else if (dir==2) y=(y+1)%N;
      else x=(x+N-1)%N;
      pos=y*N+x;
      return colors|((uint64_t)pos<<49)|((uint64_t)dir<<55);
    }
    int main(void) {
      uint64_t tortoise=step(0), hare=step(step(0));
      while (tortoise!=hare) {
        tortoise=step(tortoise);
        hare=step(step(hare));
      }
      uint64_t mu=0;
      tortoise=0;
      while (tortoise!=hare) {
        tortoise=step(tortoise);
        hare=step(hare);
        ++mu;
      }
      uint64_t lambda=1;
      hare=step(tortoise);
      while (tortoise!=hare) {
        hare=step(hare);
        ++lambda;
      }
      assert(mu==0 && lambda==PERIOD && tortoise==0);
      uint64_t state=0;
      uint64_t hash=UINT64_C(14695981039346656037);
      const uint64_t checks[]={1,10,100,1000,1000000,3000000,10000000,PERIOD-1,PERIOD};
      size_t ci=0;
      for (uint64_t i=0; i<PERIOD; ++i) {
        for (unsigned j=0; j<8; ++j) {
          hash^=(uint8_t)(state>>(8*j));
          hash*=UINT64_C(1099511628211);
        }
        state=step(state);
        assert(i+1==PERIOD || state!=0);
        if (ci<sizeof(checks)/sizeof(checks[0]) && i+1==checks[ci]) {
          fprintf(stderr,"checkpoint=%" PRIu64 " state=%016" PRIx64 "\n",i+1,state);
          ++ci;
        }
      }
      assert(state==0 && hash==UINT64_C(0x981fc1e057236ac9));
      printf("n=7 mu=%" PRIu64 " lambda=%" PRIu64 " first_return=%" PRIu64 " final=%016" PRIx64 " trace_fnv1a=%016" PRIx64 "\n",mu,lambda,lambda,state,hash);
      return 0;
    }
    File identity
    Recorded filename
    R440.txt
    Download SHA-256
    5239e92a3a1f3fbf3fe548fa47c6f4159bb22af103bb7b4e44f5fcfbae060a4b
Continue this work
Replay material: runnable

4Reproduce

Replay package: runnable

The command and source are recorded. The environment or expected result still needs pinning.

cc -O3 -std=c11 certificate.c -o certificate && ./certificate > report.txt && shasum -a 256 report.txt && cat report.txt

Verification source: math.stackexchange.com ↗, Self-contained ISO C certificate reproduced by TheoremDB entry research on 2026-07-24

Missing for a complete replay: expected output.

Recorded artifact fields

5What it produced

Execution

date2026-07-24arithmeticexact unsigned 64-bit state transitionscompilerApple clang 21.0.0wall time seconds2.1 seconds

6How it connects

Recorded for

Machine-readable record

Copy the structured record when continuing this work with an agent.

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R440",
  "content_hash": null,
  "slug": "lat7-artifact-full-state-cycle-certificate",
  "type": "artifact",
  "title": "Bit-packed cycle detection and direct replay certificate",
  "summary": "A self-contained C program runs Floyd detection and a full 64,165,598-step replay over exact 57-bit states.",
  "relevance": "This supplies a computation, dataset, or executable check used to assess the target problem.",
  "relevance_source": "derived",
  "body": "The replay hashes the little-endian eight-byte encoding of each state at times 0 through 64,165,597 with standard 64-bit FNV-1a. The digest is `981fc1e057236ac9`. The final packed state is `0000000000000000`.\n\nSelected packed-state checkpoints are\n\\[\n\\begin{array}{r|c}\n1&0082000000000001\\\\\n10&011b040000000183\\\\\n100&0022a15941424494\\\\\n1000&015359d5f9766cb9\\\\\n1000000&0161407e02511400\\\\\n3000000&002edbee6e815e65\\\\\n10000000&00179517efcf3c12\\\\\n64165597&008e000000000080\\\\\n64165598&0000000000000000\n\\end{array}\n\\]\nThe canonical stdout line, including its terminating line feed, has SHA-256 digest `e78091b2d9b11ecd5126acd78067e4efc1397f09aa1ee18c5afe50eb2c0a75f6`. A reproduced optimized run took about two seconds.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "every state in the complete orbit of the stated 7 by 7 all-white initial condition through its first return",
    "bounds": {
      "first_step": {
        "min": 0,
        "max": 0
      },
      "last_step": {
        "min": 64165598,
        "max": 64165598
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "runnable",
    "kind": "inline_c_computation",
    "command": "cc -O3 -std=c11 certificate.c -o certificate && ./certificate > report.txt && shasum -a 256 report.txt && cat report.txt",
    "runtime": "ISO C, reproduced with Apple clang 21.0.0",
    "citation": {
      "url": "https://math.stackexchange.com/questions/3296855/what-is-the-period-of-langtons-ant-on-a-torus",
      "locator": "Self-contained ISO C certificate reproduced by TheoremDB entry research on 2026-07-24"
    },
    "runtime_seconds": 2.1,
    "inline_source": "#include <assert.h>\n#include <inttypes.h>\n#include <stdint.h>\n#include <stdio.h>\n#define N 7u\n#define PERIOD UINT64_C(64165598)\n#define COLOR_MASK ((UINT64_C(1)<<49)-1)\nstatic inline uint64_t step(uint64_t state) {\n  uint64_t colors=state&COLOR_MASK;\n  unsigned pos=(unsigned)((state>>49)&63u);\n  unsigned dir=(unsigned)((state>>55)&3u);\n  unsigned black=(unsigned)((colors>>pos)&1u);\n  colors^=UINT64_C(1)<<pos;\n  dir=black ? ((dir+3u)&3u) : ((dir+1u)&3u);\n  unsigned x=pos%N, y=pos/N;\n  if (dir==0) y=(y+N-1)%N;\n  else if (dir==1) x=(x+1)%N;\n  else if (dir==2) y=(y+1)%N;\n  else x=(x+N-1)%N;\n  pos=y*N+x;\n  return colors|((uint64_t)pos<<49)|((uint64_t)dir<<55);\n}\nint main(void) {\n  uint64_t tortoise=step(0), hare=step(step(0));\n  while (tortoise!=hare) {\n    tortoise=step(tortoise);\n    hare=step(step(hare));\n  }\n  uint64_t mu=0;\n  tortoise=0;\n  while (tortoise!=hare) {\n    tortoise=step(tortoise);\n    hare=step(hare);\n    ++mu;\n  }\n  uint64_t lambda=1;\n  hare=step(tortoise);\n  while (tortoise!=hare) {\n    hare=step(hare);\n    ++lambda;\n  }\n  assert(mu==0 && lambda==PERIOD && tortoise==0);\n  uint64_t state=0;\n  uint64_t hash=UINT64_C(14695981039346656037);\n  const uint64_t checks[]={1,10,100,1000,1000000,3000000,10000000,PERIOD-1,PERIOD};\n  size_t ci=0;\n  for (uint64_t i=0; i<PERIOD; ++i) {\n    for (unsigned j=0; j<8; ++j) {\n      hash^=(uint8_t)(state>>(8*j));\n      hash*=UINT64_C(1099511628211);\n    }\n    state=step(state);\n    assert(i+1==PERIOD || state!=0);\n    if (ci<sizeof(checks)/sizeof(checks[0]) && i+1==checks[ci]) {\n      fprintf(stderr,\"checkpoint=%\" PRIu64 \" state=%016\" PRIx64 \"\\n\",i+1,state);\n      ++ci;\n    }\n  }\n  assert(state==0 && hash==UINT64_C(0x981fc1e057236ac9));\n  printf(\"n=7 mu=%\" PRIu64 \" lambda=%\" PRIu64 \" first_return=%\" PRIu64 \" final=%016\" PRIx64 \" trace_fnv1a=%016\" PRIx64 \"\\n\",mu,lambda,lambda,state,hash);\n  return 0;\n}",
    "missing": [
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://math.stackexchange.com/questions/3296855/what-is-the-period-of-langtons-ant-on-a-torus",
    "locator": "Self-contained ISO C certificate reproduced by TheoremDB entry research on 2026-07-24"
  },
  "models": [],
  "continuation": null,
  "relations": [
    {
      "slug": "R442",
      "title": "The complete initial state first returns after 64,165,598 updates",
      "object_type": "claim",
      "relation": "verifies",
      "direction": "outgoing"
    },
    {
      "slug": "R441",
      "title": "A public finite-torus table already records the same period",
      "object_type": "attempt",
      "relation": "informs",
      "direction": "incoming"
    },
    {
      "slug": "langton-ant-seven-torus-return",
      "title": "langton ant seven torus return",
      "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.

Sign in to follow

Sign in in another tab, then return here.

Open sign-in in another tab

Report a problem

Report location:

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.