FA-14486 / Numerics / Open access
Repeating radix fraction: remainder transition · case 01
The exact repeating radix fraction result violates the stated contract at remainder transition.
ROOT CAUSE
The remainder transition step uses t//q instead of t%q.
VERIFIED REPAIR
Use t%q at the remainder transition step.
Unsuccessful approach: The partial repair (t%q)//base still violates the remainder transition 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=seen[r]
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, 2, 2], [[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, 2, 4], [[2], []]), ([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, 2, 5], [[], [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, 2, 6], [[3], []]), ([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]])], [([1, 2, 7], [[], [3]]), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[], [1]] | [[1], []] | Failed |
| explicit oracle 1 | [[], [1]] | [[], [1]] | Passed |
| explicit oracle 2 | [[], []] | [[], []] | Passed |
| explicit oracle 3 | [[7, 2, 0], []] | [[], [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 / 3f8be0bd0ad1f0ec7fec1a08672bcd3b7dc7cad11954fd2663ed905772e5533f
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]
return [digits[:k],digits[k:]]
seen[r]=len(digits)
t=r*base
digits.append(t//q)
r=(t%q)//base
return [digits,[]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 2, 2], [[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, 2, 4], [[2], []]), ([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, 2, 5], [[], [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, 2, 6], [[3], []]), ([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]])], [([1, 2, 7], [[], [3]]), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[1], []] | [[1], []] | Passed |
| explicit oracle 1 | [[1], []] | [[], [1]] | Failed |
| explicit oracle 2 | [[], []] | [[], []] | Passed |
| explicit oracle 3 | [[7], [0]] | [[], [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 / 2d89798b6928607af883de7fdf31dbc1810580ee28e4dc04507108512dcef7b1
3 / The verified repair
Exit 0"""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]
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, 2, 2], [[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, 2, 4], [[2], []]), ([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, 2, 5], [[], [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, 2, 6], [[3], []]), ([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]])], [([1, 2, 7], [[], [3]]), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[1], []] | [[1], []] | Passed |
| 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 / 60b00674735b82372bfa99294eb74eebd6f49fee4c25812fae88ebc3ad52ba34
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.273289+00:00.
Case digest / 92e4a0565568a02344913c9def0eb263dcb8182473813cf3ea2cf280afb473a8