TheoremDB

Problem packetResearch packetR631

R631Executable evidence

Exhaustive increasing-prime sweep

View replayOpen source ↗
Link to a section

Authored summary

A sieve and first-visit table test all 94998 primes through the first qualifying modulus.

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

Recorded status: available

Recorded scope: every prime modulus p from 2 through 1229237 for the orbit of 0 under x -> x^2+1

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "every prime modulus p from 2 through 1229237 for the orbit of 0 under x -> x^2+1",
  "bounds": {
    "p": {
      "min": 2,
      "max": 1229237
    }
  },
  "exhaustive": true
}

Originating problem: A length-5000 orbit of x^2+1 modulo a prime below ten million

Recorded relationships: The first qualifying prime is 1229237

Authored record and scope
Authored title
Exhaustive increasing-prime sweep
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "every prime modulus p from 2 through 1229237 for the orbit of 0 under x -> x^2+1", "bounds": { "p": { "min": 2, "max": 1229237 } }, "exhaustive": true }
Linked research record IDs
R633

2Authored explanation

The C program sieves every prime through 1229237, visits them in increasing order, and iterates \(x\mapsto x^2+1\pmod p\). Epoch-stamped arrays retain the first index of each residue without clearing the arrays between primes. A repeated residue gives the total distinct count, its first index gives the preperiod, and their difference gives the period.

The program returned `tested=94998 witness=1229237 total=5145 mu=2520 lambda=2625 repeat=817978 previous_best=4479 previous_p=1198537 previous_mu=3281 previous_lambda=1198`. An earlier run over the same range also reproduced the candidate datum \(p=192553\), total 1808, preperiod 293, and period 1515.

Files and source

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

  • R631.txt1,070 bytes · No SHA-256 recorded
    Preview R631.txt
    #include <stdint.h>
    #include <stdio.h>
    #include <stdlib.h>
    #define LIMIT 1229238
    int main(void) {
      uint8_t *composite = calloc(LIMIT, 1);
      uint32_t *stamp = calloc(LIMIT, sizeof(uint32_t));
      uint32_t *first = malloc((size_t)LIMIT * sizeof(uint32_t));
      if (!composite || !stamp || !first) return 2;
      for (int i = 2; (int64_t)i*i < LIMIT; ++i)
        if (!composite[i])
          for (int j = i*i; j < LIMIT; j += i) composite[j] = 1;
      uint32_t epoch=0, tested=0, best=0, best_p=0, best_mu=0, best_lam=0;
      for (uint32_t p=2; p<LIMIT; ++p) if (!composite[p]) {
        ++epoch; ++tested;
        uint32_t x=0, i=0;
        while (stamp[x] != epoch) {
          stamp[x]=epoch; first[x]=i++;
          x=(uint32_t)(((uint64_t)x*x+1)%p);
        }
        uint32_t mu=first[x], lam=i-mu;
        if (i > 5000) {
          printf("tested=%u witness=%u total=%u mu=%u lambda=%u repeat=%u previous_best=%u previous_p=%u previous_mu=%u previous_lambda=%u\n", tested,p,i,mu,lam,x,best,best_p,best_mu,best_lam);
          return 0;
        }
        if (i > best) { best=i; best_p=p; best_mu=mu; best_lam=lam; }
      }
      return 1;
    }
    File identity
    Recorded filename
    R631.txt
    Download SHA-256
    1e269e5061dcb60ae06df551c5e1fd0244d954b239a22f86228471a8c6633afd
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 sweep.c -o sweep && ./sweep

Verification source: arxiv.org ↗, Self-contained ISO C computation run by TheoremDB entry research on 2026-07-24

Missing for a complete replay: expected output.

Recorded artifact fields

5What it produced

Execution

date2026-07-24prime count94,998stopping rulefirst prime with total distinct orbit length greater than 5000resultqualifying witness found

6How it connects

Supports

Recorded for

Machine-readable record

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

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R631",
  "content_hash": null,
  "slug": "qorp-artifact-exhaustive-prime-sweep",
  "type": "artifact",
  "title": "Exhaustive increasing-prime sweep",
  "summary": "A sieve and first-visit table test all 94998 primes through the first qualifying modulus.",
  "relevance": "This supplies a computation, dataset, or executable check used to assess the target problem.",
  "relevance_source": "derived",
  "body": "The C program sieves every prime through 1229237, visits them in increasing order, and iterates \\(x\\mapsto x^2+1\\pmod p\\). Epoch-stamped arrays retain the first index of each residue without clearing the arrays between primes. A repeated residue gives the total distinct count, its first index gives the preperiod, and their difference gives the period.\n\nThe program returned `tested=94998 witness=1229237 total=5145 mu=2520 lambda=2625 repeat=817978 previous_best=4479 previous_p=1198537 previous_mu=3281 previous_lambda=1198`. An earlier run over the same range also reproduced the candidate datum \\(p=192553\\), total 1808, preperiod 293, and period 1515.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "every prime modulus p from 2 through 1229237 for the orbit of 0 under x -> x^2+1",
    "bounds": {
      "p": {
        "min": 2,
        "max": 1229237
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "runnable",
    "kind": "inline_c_computation",
    "command": "cc -O3 -std=c11 sweep.c -o sweep && ./sweep",
    "runtime": "ISO C, reproduced with Apple clang 21.0.0",
    "citation": {
      "url": "https://arxiv.org/abs/1701.02707",
      "locator": "Self-contained ISO C computation run by TheoremDB entry research on 2026-07-24"
    },
    "inline_source": "#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#define LIMIT 1229238\nint main(void) {\n  uint8_t *composite = calloc(LIMIT, 1);\n  uint32_t *stamp = calloc(LIMIT, sizeof(uint32_t));\n  uint32_t *first = malloc((size_t)LIMIT * sizeof(uint32_t));\n  if (!composite || !stamp || !first) return 2;\n  for (int i = 2; (int64_t)i*i < LIMIT; ++i)\n    if (!composite[i])\n      for (int j = i*i; j < LIMIT; j += i) composite[j] = 1;\n  uint32_t epoch=0, tested=0, best=0, best_p=0, best_mu=0, best_lam=0;\n  for (uint32_t p=2; p<LIMIT; ++p) if (!composite[p]) {\n    ++epoch; ++tested;\n    uint32_t x=0, i=0;\n    while (stamp[x] != epoch) {\n      stamp[x]=epoch; first[x]=i++;\n      x=(uint32_t)(((uint64_t)x*x+1)%p);\n    }\n    uint32_t mu=first[x], lam=i-mu;\n    if (i > 5000) {\n      printf(\"tested=%u witness=%u total=%u mu=%u lambda=%u repeat=%u previous_best=%u previous_p=%u previous_mu=%u previous_lambda=%u\\n\", tested,p,i,mu,lam,x,best,best_p,best_mu,best_lam);\n      return 0;\n    }\n    if (i > best) { best=i; best_p=p; best_mu=mu; best_lam=lam; }\n  }\n  return 1;\n}",
    "missing": [
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://arxiv.org/abs/1701.02707",
    "locator": "Self-contained ISO C computation run by TheoremDB entry research on 2026-07-24"
  },
  "models": [],
  "continuation": null,
  "relations": [
    {
      "slug": "R633",
      "title": "The first qualifying prime is 1229237",
      "object_type": "claim",
      "relation": "supports",
      "direction": "outgoing"
    },
    {
      "slug": "R634",
      "title": "Quadratic orbits satisfy a sublinear general recurrence bound",
      "object_type": "claim",
      "relation": "informs",
      "direction": "incoming"
    },
    {
      "slug": "quadratic-orbit-record-prime-10m",
      "title": "quadratic orbit record prime 10m",
      "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.