TheoremDB

Problem packetResearch packetR632

R632Executable evidence

Independent cycle and primality verification

View replayOpen source ↗
Link to a section

Authored summary

A standard-library Python check reproduces the collision with both a first-visit map and Floyd's algorithm, then verifies primality.

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

Recorded status: available

Recorded scope: the orbit and primality certificate for p=1229237

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "the orbit and primality certificate for p=1229237",
  "bounds": {
    "p": {
      "min": 1229237,
      "max": 1229237
    }
  },
  "exhaustive": true
}

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

Authored record and scope
Authored title
Independent cycle and primality verification
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "the orbit and primality certificate for p=1229237", "bounds": { "p": { "min": 1229237, "max": 1229237 } }, "exhaustive": true }

2Authored explanation

The verifier constructs the orbit with a Python dictionary and obtains total 5145, preperiod 2520, period 2625, and repeated residue 817978. Floyd's cycle algorithm uses constant auxiliary space and independently returns the same preperiod, period, and cycle entry. The last new residue is 1039286, which maps to 817978.

A direct divisibility test through 1108 certifies primality independently of the sieve. The verifier also checks the displayed Pocklington congruences and the orbit digest. Its first ten residues are 0, 1, 2, 5, 26, 677, 458330, 848734, 540676, and 769059.

Files and source

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

  • R632.txt975 bytes · No SHA-256 recorded
    Preview R632.txt
    from hashlib import sha256
    from math import gcd, isqrt
    import json
    p = 1229237
    assert all(p % d for d in range(2, isqrt(p)+1))
    f = lambda x: (x*x+1) % p
    seen, orbit, x = {}, [], 0
    while x not in seen:
        seen[x] = len(orbit); orbit.append(x); x = f(x)
    mu, lam = seen[x], len(orbit)-seen[x]
    assert (len(orbit), mu, lam, x) == (5145, 2520, 2625, 817978)
    t, h = f(0), f(f(0))
    while t != h: t, h = f(t), f(f(h))
    mu2, t = 0, 0
    while t != h: t, h, mu2 = f(t), f(h), mu2+1
    lam2, h = 1, f(t)
    while t != h: h, lam2 = f(h), lam2+1
    assert (mu2, lam2, t) == (2520, 2625, 817978)
    assert sha256(json.dumps(orbit,separators=(',',':')).encode()).hexdigest() == '9cd1f30ec1c06adb76c1c437bccaabb81a6f023f65ca1b81f459704b85f51db3'
    assert p-1 == 2**2 * 17 * 18077 and pow(2,p-1,p) == 1
    for q, residue in ((2,1229236),(17,1054755),(18077,163446)):
        assert all(q % d for d in range(2, isqrt(q)+1))
        assert pow(2,(p-1)//q,p) == residue and gcd(residue-1,p) == 1
    print(len(orbit), mu, lam, x)
    File identity
    Recorded filename
    R632.txt
    Download SHA-256
    6f9274d0cdf520e7778e03cdae360112a5f314a24e1024900942b66950354b27
Continue this work
Replay material: partial

4Reproduce

Replay package: partial

Part of the replay path is recorded. Check the missing fields before comparing a new run.

Verification source: arxiv.org ↗, Self-contained Python 3 standard-library verification run by TheoremDB entry research on 2026-07-24

Missing for a complete replay: command, expected output.

Recorded artifact fields

5What it produced

6How it connects

Tests

Recorded for

Machine-readable record

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

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R632",
  "content_hash": null,
  "slug": "qorp-artifact-independent-witness-verification",
  "type": "artifact",
  "title": "Independent cycle and primality verification",
  "summary": "A standard-library Python check reproduces the collision with both a first-visit map and Floyd's algorithm, then verifies primality.",
  "relevance": "This supplies a computation, dataset, or executable check used to assess the target problem.",
  "relevance_source": "derived",
  "body": "The verifier constructs the orbit with a Python dictionary and obtains total 5145, preperiod 2520, period 2625, and repeated residue 817978. Floyd's cycle algorithm uses constant auxiliary space and independently returns the same preperiod, period, and cycle entry. The last new residue is 1039286, which maps to 817978.\n\nA direct divisibility test through 1108 certifies primality independently of the sieve. The verifier also checks the displayed Pocklington congruences and the orbit digest. Its first ten residues are 0, 1, 2, 5, 26, 677, 458330, 848734, 540676, and 769059.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "the orbit and primality certificate for p=1229237",
    "bounds": {
      "p": {
        "min": 1229237,
        "max": 1229237
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "partial",
    "kind": "inline_python_computation",
    "runtime": "Python 3.9.6 standard library",
    "citation": {
      "url": "https://arxiv.org/abs/1701.02707",
      "locator": "Self-contained Python 3 standard-library verification run by TheoremDB entry research on 2026-07-24"
    },
    "inline_source": "from hashlib import sha256\nfrom math import gcd, isqrt\nimport json\np = 1229237\nassert all(p % d for d in range(2, isqrt(p)+1))\nf = lambda x: (x*x+1) % p\nseen, orbit, x = {}, [], 0\nwhile x not in seen:\n    seen[x] = len(orbit); orbit.append(x); x = f(x)\nmu, lam = seen[x], len(orbit)-seen[x]\nassert (len(orbit), mu, lam, x) == (5145, 2520, 2625, 817978)\nt, h = f(0), f(f(0))\nwhile t != h: t, h = f(t), f(f(h))\nmu2, t = 0, 0\nwhile t != h: t, h, mu2 = f(t), f(h), mu2+1\nlam2, h = 1, f(t)\nwhile t != h: h, lam2 = f(h), lam2+1\nassert (mu2, lam2, t) == (2520, 2625, 817978)\nassert sha256(json.dumps(orbit,separators=(',',':')).encode()).hexdigest() == '9cd1f30ec1c06adb76c1c437bccaabb81a6f023f65ca1b81f459704b85f51db3'\nassert p-1 == 2**2 * 17 * 18077 and pow(2,p-1,p) == 1\nfor q, residue in ((2,1229236),(17,1054755),(18077,163446)):\n    assert all(q % d for d in range(2, isqrt(q)+1))\n    assert pow(2,(p-1)//q,p) == residue and gcd(residue-1,p) == 1\nprint(len(orbit), mu, lam, x)",
    "missing": [
      "command",
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://arxiv.org/abs/1701.02707",
    "locator": "Self-contained Python 3 standard-library verification 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": "tests",
      "direction": "outgoing"
    },
    {
      "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.