FAILURE MAP
← Case archive

FA-14471 / Numerics / Open access

Repeating radix fraction: remainder position · case 01

The exact repeating radix fraction result violates the stated contract at remainder position.

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

ROOT CAUSE

The remainder position step uses len(digits)+1 instead of len(digits).

THE FAILURE

The remainder position step uses len(digits)+1 instead of len(digits).

Unsuccessful approach: The partial repair max(0,len(digits)-1) still violates the remainder position 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)+1
     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, 3], [[], [1]]), ([1, 6, 2], [[0], [0, 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, 5], [[], [2]]), ([1, 6, 8], [[1], [2, 5]]), ([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, 7], [[], [3]]), ([5, 6, 4], [[3], [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, 3, 2], [[], [0, 1]]), ([1, 10, 4], [[0], [1, 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, 3, 4], [[], [1]]), ([1, 10, 8], [[0], [6, 3, 1, 4]]), ([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]]Failed
explicit oracle 1[[0, 0], [1]][[0], [0, 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 / f60bc1eec21285d0ddb58ab343ae38233d94e6d340628e73d3c023aa27fab461

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]=max(0,len(digits)-1)
     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, 3], [[], [1]]), ([1, 6, 2], [[0], [0, 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, 5], [[], [2]]), ([1, 6, 8], [[1], [2, 5]]), ([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, 7], [[], [3]]), ([5, 6, 4], [[3], [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, 3, 2], [[], [0, 1]]), ([1, 10, 4], [[0], [1, 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, 3, 4], [[], [1]]), ([1, 10, 8], [[0], [6, 3, 1, 4]]), ([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[[], [0, 0, 1]][[0], [0, 1]]Failed
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 / 1fc0542d7badb9bad3de62573527ac539046869d98fa0cd43c0416e6db8189bc

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

Case digest / bd66071fdaec75502168769229b08153b65930453636ed3db176cdc965692327