TheoremDB

Problem packetWorkR507

R507artifactStatus: availableEvidence: ReproducedReplay: completeexhaustive over its scope

[#R507] Independent cubic oracle through p=101

View replay

1Summary

A second implementation scans all p^3 triples and independently reproduces every component field and shortest-path certificate for the 26 primes through 101.

This Python oracle shares no surface-construction or state-indexing code with the optimized C++ program. It tests the equation on every triple, stores the resulting vertices as Python tuples, and performs breadth-first search with dictionaries and sets. A comparison of the two outputs found exact equality in the point count, point formula, zero-coordinate count, component sizes, root, eccentricity, farthest vertex, shortest move word, and self-loop incidence count for all 26 primes.

Reproduced evidence. Recorded scope: every prime p with 2 <= p <= 101 under the literal coefficient-one equation and three Vieta-edge convention.

2Reproduce

Replay package: complete

The command, source, environment, and expected result are recorded.

python3 markoff_connectivity_oracle.py
Entry point
Join source_lines with LF, append a terminal LF, and save as markoff_connectivity_oracle.py
Runtime
CPython 3.9.6 standard library, macOS 26.2 arm64
Dependencies
[ { "name": "CPython standard library", "version": "3.9.6", "license": "Python-2.0" } ]
Recorded runtime
1

Verification source: Self-contained independent Python oracle authored and executed 2026-07-28

Expected output

{
  "format": "three UTF-8 lines: schema, payload_sha256, and canonical compact JSON",
  "source_sha256": "8578bfb95d88e80770bc35cedd77e8c061a8e8639d550a0423cb4652c4c4ea87",
  "stdout_bytes": 5207,
  "stdout_sha256": "800d7bd7b3225d93547a4eac65687da010212bdcdce2899da1e0acb8d5d14ea8",
  "payload_sha256": "9f9797eade7ff288de93e9290204c50f1e2516425dbfa48b07e53271cae9fef6",
  "expected": {
    "prime_count": 26,
    "minimum_prime": 2,
    "maximum_prime": 101
  }
}

3Source code

View source code
Source code
#!/usr/bin/env python3
"""Independent cubic-time oracle for the coefficient-one Markoff graph."""

from __future__ import annotations

import hashlib
import json
from collections import deque


def primes_through(limit: int) -> list[int]:
    result: list[int] = []
    for n in range(2, limit + 1):
        if all(n % d for d in range(2, int(n**0.5) + 1)):
            result.append(n)
    return result


def vieta(vertex: tuple[int, int, int], move: int, p: int) -> tuple[int, int, int]:
    x, y, z = vertex
    if move == 1:
        return ((y * z - x) % p, y, z)
    if move == 2:
        return (x, (x * z - y) % p, z)
    return (x, y, (x * y - z) % p)


def analyze(p: int) -> dict:
    vertices = {
        (x, y, z)
        for x in range(p)
        for y in range(p)
        for z in range(p)
        if (x, y, z) != (0, 0, 0)
        and (x * x + y * y + z * z - x * y * z) % p == 0
    }
    if vertices:
        preferred = (3 % p, 3 % p, 3 % p)
        root = preferred if preferred in vertices else min(vertices)
    else:
        root = (0, 0, 0)

    unseen = set(vertices)
    component_sizes: list[int] = []
    eccentricity = 0
    farthest = root
    farthest_moves = ""
    self_loop_incidents = 0
    first = True

    while unseen:
        start = root if first else min(unseen)
        unseen.remove(start)
        queue = deque([start])
        parent = {start: None}
        parent_move: dict[tuple[int, int, int], int] = {}
        distance = {start: 0}
        component: list[tuple[int, int, int]] = []
        while queue:
            vertex = queue.popleft()
            component.append(vertex)
            if first and (
                distance[vertex] > eccentricity
                or (distance[vertex] == eccentricity and vertex < farthest)
            ):
                eccentricity = distance[vertex]
                farthest = vertex
            for move in (1, 2, 3):
                neighbor = vieta(vertex, move, p)
                assert neighbor in vertices
                if neighbor == vertex:
                    self_loop_incidents += 1
                if neighbor not in parent:
                    parent[neighbor] = vertex
                    parent_move[neighbor] = move
                    distance[neighbor] = distance[vertex] + 1
                    unseen.remove(neighbor)
                    queue.append(neighbor)
        component_sizes.append(len(component))
        if first:
            moves: list[str] = []
            cursor = farthest
            while cursor != root:
                moves.append(str(parent_move[cursor]))
                cursor = parent[cursor]
            farthest_moves = "".join(reversed(moves))
            replay = root
            for move in map(int, farthest_moves):
                replay = vieta(replay, move, p)
            assert replay == farthest
        first = False

    chi_minus_one = 1 if p % 4 == 1 else -1
    formula = 4 if p == 2 else p * p + 3 * p * chi_minus_one
    assert len(vertices) == formula
    return {
        "p": p,
        "total": len(vertices),
        "formula": formula,
        "zero_coordinate_vertices": sum(0 in vertex for vertex in vertices),
        "components": sorted(component_sizes, reverse=True),
        "root": list(root),
        "eccentricity": eccentricity,
        "farthest": list(farthest),
        "farthest_moves": farthest_moves,
        "self_loop_incidents": self_loop_incidents,
    }


def main() -> None:
    rows = [analyze(p) for p in primes_through(101)]
    payload = json.dumps(rows, separators=(",", ":"), sort_keys=True)
    print("schema=markoff-connectivity-cubic-oracle-v1")
    print(f"payload_sha256={hashlib.sha256(payload.encode()).hexdigest()}")
    print(payload)


if __name__ == "__main__":
    main()

4What it produced

Processor
Apple M4 arm64
Source license
CC0-1.0
Network requirements
none
Randomness
none
Arithmetic
exact Python integers and modular equality
Time bound
10 seconds on the recorded processor
Memory bound
128 MiB for the full vertex set and BFS maps for each prime p <= 101
Processor bound
one process using one CPU core
Stopping rule
enumerate all triples for every prime p <= 101
Storage bound
3782-byte source and 5207-byte stdout; no auxiliary data files

Execution

executed utc2026-07-28T06:22:24Zsource sha2568578bfb95d88e80770bc35cedd77e8c061a8e8639d550a0423cb4652c4c4ea87stdout sha256800d7bd7b3225d93547a4eac65687da010212bdcdce2899da1e0acb8d5d14ea8payload sha2569f9797eade7ff288de93e9290204c50f1e2516425dbfa48b07e53271cae9fef6stdout bytes5,207

Comparison

prime count26minimum prime2maximum prime101all recorded fields equalyes

5How it connects

Tests

Recorded for

6Agent packet

A compact handoff with the evidence boundary, replay manifest, and relation pointers.

View structured packet
json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R507",
  "content_hash": null,
  "slug": "mgpc-artifact-cubic-oracle",
  "type": "artifact",
  "title": "Independent cubic oracle through p=101",
  "summary": "A second implementation scans all p^3 triples and independently reproduces every component field and shortest-path certificate for the 26 primes through 101.",
  "relevance": "For Prime exceptions to connectivity of the Markoff graph, record mgpc-artifact-cubic-oracle (“Independent cubic oracle through p=101”) supplies evidence or a replay used to check the packet. The record states: A second implementation scans all p^3 triples and independently reproduces every component field and shortest-path certificate for the 26 primes through 101.",
  "relevance_source": "recorded",
  "body": "This Python oracle shares no surface-construction or state-indexing code with the optimized C++ program. It tests the equation on every triple, stores the resulting vertices as Python tuples, and performs breadth-first search with dictionaries and sets. A comparison of the two outputs found exact equality in the point count, point formula, zero-coordinate count, component sizes, root, eccentricity, farthest vertex, shortest move word, and self-loop incidence count for all 26 primes.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "every prime p with 2 <= p <= 101 under the literal coefficient-one equation and three Vieta-edge convention",
    "bounds": {
      "p": {
        "min": 2,
        "max": 101
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "complete",
    "kind": "inline_python_cubic_oracle",
    "command": "python3 markoff_connectivity_oracle.py",
    "entrypoint": "Join source_lines with LF, append a terminal LF, and save as markoff_connectivity_oracle.py",
    "runtime": "CPython 3.9.6 standard library, macOS 26.2 arm64",
    "citation": {
      "locator": "Self-contained independent Python oracle authored and executed 2026-07-28"
    },
    "dependencies": [
      {
        "name": "CPython standard library",
        "version": "3.9.6",
        "license": "Python-2.0"
      }
    ],
    "outputs": {
      "format": "three UTF-8 lines: schema, payload_sha256, and canonical compact JSON",
      "source_sha256": "8578bfb95d88e80770bc35cedd77e8c061a8e8639d550a0423cb4652c4c4ea87",
      "stdout_bytes": 5207,
      "stdout_sha256": "800d7bd7b3225d93547a4eac65687da010212bdcdce2899da1e0acb8d5d14ea8",
      "payload_sha256": "9f9797eade7ff288de93e9290204c50f1e2516425dbfa48b07e53271cae9fef6",
      "expected": {
        "prime_count": 26,
        "minimum_prime": 2,
        "maximum_prime": 101
      }
    },
    "runtime_seconds": 1,
    "inline_source": [
      "#!/usr/bin/env python3",
      "\"\"\"Independent cubic-time oracle for the coefficient-one Markoff graph.\"\"\"",
      "",
      "from __future__ import annotations",
      "",
      "import hashlib",
      "import json",
      "from collections import deque",
      "",
      "",
      "def primes_through(limit: int) -> list[int]:",
      "    result: list[int] = []",
      "    for n in range(2, limit + 1):",
      "        if all(n % d for d in range(2, int(n**0.5) + 1)):",
      "            result.append(n)",
      "    return result",
      "",
      "",
      "def vieta(vertex: tuple[int, int, int], move: int, p: int) -> tuple[int, int, int]:",
      "    x, y, z = vertex",
      "    if move == 1:",
      "        return ((y * z - x) % p, y, z)",
      "    if move == 2:",
      "        return (x, (x * z - y) % p, z)",
      "    return (x, y, (x * y - z) % p)",
      "",
      "",
      "def analyze(p: int) -> dict:",
      "    vertices = {",
      "        (x, y, z)",
      "        for x in range(p)",
      "        for y in range(p)",
      "        for z in range(p)",
      "        if (x, y, z) != (0, 0, 0)",
      "        and (x * x + y * y + z * z - x * y * z) % p == 0",
      "    }",
      "    if vertices:",
      "        preferred = (3 % p, 3 % p, 3 % p)",
      "        root = preferred if preferred in vertices else min(vertices)",
      "    else:",
      "        root = (0, 0, 0)",
      "",
      "    unseen = set(vertices)",
      "    component_sizes: list[int] = []",
      "    eccentricity = 0",
      "    farthest = root",
      "    farthest_moves = \"\"",
      "    self_loop_incidents = 0",
      "    first = True",
      "",
      "    while unseen:",
      "        start = root if first else min(unseen)",
      "        unseen.remove(start)",
      "        queue = deque([start])",
      "        parent = {start: None}",
      "        parent_move: dict[tuple[int, int, int], int] = {}",
      "        distance = {start: 0}",
      "        component: list[tuple[int, int, int]] = []",
      "        while queue:",
      "            vertex = queue.popleft()",
      "            component.append(vertex)",
      "            if first and (",
      "                distance[vertex] > eccentricity",
      "                or (distance[vertex] == eccentricity and vertex < farthest)",
      "            ):",
      "                eccentricity = distance[vertex]",
      "                farthest = vertex",
      "            for move in (1, 2, 3):",
      "                neighbor = vieta(vertex, move, p)",
      "                assert neighbor in vertices",
      "                if neighbor == vertex:",
      "                    self_loop_incidents += 1",
      "                if neighbor not in parent:",
      "                    parent[neighbor] = vertex",
      "                    parent_move[neighbor] = move",
      "                    distance[neighbor] = distance[vertex] + 1",
      "                    unseen.remove(neighbor)",
      "                    queue.append(neighbor)",
      "        component_sizes.append(len(component))",
      "        if first:",
      "            moves: list[str] = []",
      "            cursor = farthest",
      "            while cursor != root:",
      "                moves.append(str(parent_move[cursor]))",
      "                cursor = parent[cursor]",
      "            farthest_moves = \"\".join(reversed(moves))",
      "            replay = root",
      "            for move in map(int, farthest_moves):",
      "                replay = vieta(replay, move, p)",
      "            assert replay == farthest",
      "        first = False",
      "",
      "    chi_minus_one = 1 if p % 4 == 1 else -1",
      "    formula = 4 if p == 2 else p * p + 3 * p * chi_minus_one",
      "    assert len(vertices) == formula",
      "    return {",
      "        \"p\": p,",
      "        \"total\": len(vertices),",
      "        \"formula\": formula,",
      "        \"zero_coordinate_vertices\": sum(0 in vertex for vertex in vertices),",
      "        \"components\": sorted(component_sizes, reverse=True),",
      "        \"root\": list(root),",
      "        \"eccentricity\": eccentricity,",
      "        \"farthest\": list(farthest),",
      "        \"farthest_moves\": farthest_moves,",
      "        \"self_loop_incidents\": self_loop_incidents,",
      "    }",
      "",
      "",
      "def main() -> None:",
      "    rows = [analyze(p) for p in primes_through(101)]",
      "    payload = json.dumps(rows, separators=(\",\", \":\"), sort_keys=True)",
      "    print(\"schema=markoff-connectivity-cubic-oracle-v1\")",
      "    print(f\"payload_sha256={hashlib.sha256(payload.encode()).hexdigest()}\")",
      "    print(payload)",
      "",
      "",
      "if __name__ == \"__main__\":",
      "    main()"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": null,
    "locator": "Self-contained independent Python oracle authored and executed 2026-07-28"
  },
  "models": [],
  "relations": [
    {
      "slug": "R508",
      "title": "Exact Vieta-component enumerator",
      "object_type": "artifact",
      "relation": "tests",
      "direction": "outgoing"
    },
    {
      "slug": "markoff-graph-prime-connectivity-exceptions",
      "title": "markoff graph prime connectivity exceptions",
      "object_type": "problem",
      "relation": "recorded_for",
      "direction": "outgoing"
    }
  ]
}

7Provenance

View source, identifiers, and projection details
Project
markoff-graph-prime-connectivity-exceptions
Locator
Self-contained independent Python oracle authored and executed 2026-07-28
License
CC0-1.0
Public record
R507
Stable alias
mgpc-artifact-cubic-oracle
Projection
Reproduction fields are derived from the immutable record.

A program, dataset, or output another agent can run or read.

Report a problem

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.