FA-14476 / Numerics / Open access
Repeating radix fraction: radix long division scale · case 01
The exact repeating radix fraction result violates the stated contract at radix long division scale.
ROOT CAUSE
The radix long division scale step uses r+base instead of r*base.
VERIFIED REPAIR
Use r*base at the radix long division scale step.
Unsuccessful approach: The partial repair r*q still violates the radix long division scale 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, 3], [[], [1]]), ([1, 2, 6], [[3], []]), ([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, 4], [[2], []]), ([1, 3, 2], [[], [0, 1]]), ([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, 5], [[], [2]]), ([1, 3, 6], [[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, 6], [[3], []]), ([2, 3, 2], [[], [1, 0]]), ([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 | [[2], []] | [[], [1]] | Failed |
| explicit oracle 2 | [[], []] | [[], []] | Passed |
| explicit oracle 3 | [[1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1], []] | [[], [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 / 4eae8b1b1ff4c94a5abcf531d970349a6819e04187d312f2488b40f0c38eed85
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*q
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, 3], [[], [1]]), ([1, 2, 6], [[3], []]), ([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, 4], [[2], []]), ([1, 3, 2], [[], [0, 1]]), ([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, 5], [[], [2]]), ([1, 3, 6], [[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, 6], [[3], []]), ([2, 3, 2], [[], [1, 0]]), ([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 | [[18], []] | [[], [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 / 9809c342198f169a35e77d13df311b5269d3d0b1eef782af016edfe258359039
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, 3], [[], [1]]), ([1, 2, 6], [[3], []]), ([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, 4], [[2], []]), ([1, 3, 2], [[], [0, 1]]), ([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, 5], [[], [2]]), ([1, 3, 6], [[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, 6], [[3], []]), ([2, 3, 2], [[], [1, 0]]), ([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 / 4f46e115a16c6784862f3d06cd3a236a3a8304d7b35e6a630c98b4fdcc000099
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.181832+00:00.
Case digest / 852394092ea3b4270e6e4df93062fd130e0d9fc3e2081ac89c48dd0a76614430