FAILURE MAP
← Case archive

FA-14466 / Numerics / Open access

Repeating radix fraction: cycle split · case 01

The exact repeating radix fraction result violates the stated contract at cycle split.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The cycle split step uses 0 instead of seen[r].

THE FAILURE

The cycle split step uses 0 instead of seen[r].

Unsuccessful approach: The partial repair seen[r]+1 still violates the cycle split invariant.

Case contract

Input [p,q,base], 0<=p<q, q>0, base2..10; return nonrepeating digit list and repeating digit list. Bounds: 2<=q<=19 and 2<=base<=8.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    p,q,base=x
    seen={};digits=[];r=p
    for _ in range(100):
     if r==0: return [digits,[]]
     if r in seen:
      k=0
      return [digits[:k],digits[k:]]
     seen[r]=len(digits)
     t=r*base
     digits.append(t//q)
     r=t%q
    return [digits,[]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 6, 2], [[0], [0, 1]]), ([1, 2, 3], [[], [1]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 2, 3], [[], []]), ([0, 2, 4], [[], []]), ([0, 2, 5], [[], []]), ([0, 2, 6], [[], []])], [([1, 6, 3], [[0], [1]]), ([1, 3, 2], [[], [0, 1]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 3, 5], [[], []]), ([0, 3, 6], [[], []]), ([0, 3, 7], [[], []]), ([0, 3, 8], [[], []])], [([1, 6, 4], [[0], [2]]), ([1, 3, 7], [[], [2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([2, 3, 8], [[], [5, 2]]), ([0, 4, 2], [[], []]), ([0, 4, 3], [[], []]), ([0, 4, 4], [[], []])], [([1, 6, 8], [[1], [2, 5]]), ([2, 3, 4], [[], [2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([2, 4, 4], [[2], []]), ([2, 4, 5], [[], [2]]), ([2, 4, 6], [[3], []]), ([2, 4, 7], [[], [3]])], [([5, 6, 2], [[1], [1, 0]]), ([2, 3, 8], [[], [5, 2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 5, 7], [[], []]), ([0, 5, 8], [[], []]), ([1, 5, 2], [[], [0, 0, 1, 1]]), ([1, 5, 3], [[], [0, 1, 2, 1]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
explicit oracle 0[[], [0, 0, 1]][[0], [0, 1]]Failed
explicit oracle 1[[], [1]][[], [1]]Passed
explicit oracle 2[[], []][[], []]Passed
explicit oracle 3[[], [7, 4, 5, 0, 3, 2]][[], [7, 4, 5, 0, 3, 2]]Passed
explicit oracle 4[[], []][[], []]Passed
explicit oracle 5[[], []][[], []]Passed
explicit oracle 6[[], []][[], []]Passed
explicit oracle 7[[], []][[], []]Passed

SHA-256 / 3864a7c793813a593dad6900fa6e1102dd8888e94e517ef5805c4b6c88cc19b2

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    p,q,base=x
    seen={};digits=[];r=p
    for _ in range(100):
     if r==0: return [digits,[]]
     if r in seen:
      k=seen[r]+1
      return [digits[:k],digits[k:]]
     seen[r]=len(digits)
     t=r*base
     digits.append(t//q)
     r=t%q
    return [digits,[]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 6, 2], [[0], [0, 1]]), ([1, 2, 3], [[], [1]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 2, 3], [[], []]), ([0, 2, 4], [[], []]), ([0, 2, 5], [[], []]), ([0, 2, 6], [[], []])], [([1, 6, 3], [[0], [1]]), ([1, 3, 2], [[], [0, 1]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 3, 5], [[], []]), ([0, 3, 6], [[], []]), ([0, 3, 7], [[], []]), ([0, 3, 8], [[], []])], [([1, 6, 4], [[0], [2]]), ([1, 3, 7], [[], [2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([2, 3, 8], [[], [5, 2]]), ([0, 4, 2], [[], []]), ([0, 4, 3], [[], []]), ([0, 4, 4], [[], []])], [([1, 6, 8], [[1], [2, 5]]), ([2, 3, 4], [[], [2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([2, 4, 4], [[2], []]), ([2, 4, 5], [[], [2]]), ([2, 4, 6], [[3], []]), ([2, 4, 7], [[], [3]])], [([5, 6, 2], [[1], [1, 0]]), ([2, 3, 8], [[], [5, 2]]), ([0, 2, 2], [[], []]), ([18, 19, 8], [[], [7, 4, 5, 0, 3, 2]]), ([0, 5, 7], [[], []]), ([0, 5, 8], [[], []]), ([1, 5, 2], [[], [0, 0, 1, 1]]), ([1, 5, 3], [[], [0, 1, 2, 1]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
explicit oracle 0[[0, 0], [1]][[0], [0, 1]]Failed
explicit oracle 1[[1], []][[], [1]]Failed
explicit oracle 2[[], []][[], []]Passed
explicit oracle 3[[7], [4, 5, 0, 3, 2]][[], [7, 4, 5, 0, 3, 2]]Failed
explicit oracle 4[[], []][[], []]Passed
explicit oracle 5[[], []][[], []]Passed
explicit oracle 6[[], []][[], []]Passed
explicit oracle 7[[], []][[], []]Passed

SHA-256 / 181eac564700175123e3b6a3956cea8f39a04bea7f17d16ca770310090087dee

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:39:17.135852+00:00.

Case digest / 05049ed031722105c78ca7eafb7db92bc3d642279bdf481d1c5baf3c6aa0f287