FAILURE MAP
← Case archive

FA-14481 / Numerics / Open access

Repeating radix fraction: quotient digit · case 01

The exact repeating radix fraction result violates the stated contract at quotient digit.

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

ROOT CAUSE

The quotient digit step uses t%q instead of t//q.

VERIFIED REPAIR

Use t//q at the quotient digit step.

Unsuccessful approach: The partial repair (t+q-1)//q still violates the quotient digit 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 fixtureActualExpectedOutcome
explicit oracle 0[[0], []][[1], []]Failed
explicit oracle 1[[], [1]][[], [1]]Passed
explicit oracle 2[[], []][[], []]Passed
explicit oracle 3[[], [11, 12, 1, 8, 7, 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 / c6b82b1f59acc8edf6c7d813d995a92073f5dc784dc6c858aa6dbd6bbf169b20

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-1)//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 fixtureActualExpectedOutcome
explicit oracle 0[[1], []][[1], []]Passed
explicit oracle 1[[], [2]][[], [1]]Failed
explicit oracle 2[[], []][[], []]Passed
explicit oracle 3[[], [8, 5, 6, 1, 4, 3]][[], [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 / b80ecf204a0fa08512b51c8e2dfba71b7a246e92eeca8cc5402430f6c089cc42

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 fixtureActualExpectedOutcome
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.178755+00:00.

Case digest / 14742daca314211581278801e22d9b0630202f2a145cd375af6f909e16b95742