FAILURE MAP
← Case archive

FA-15311 / Numerics / Open access

Josephus elimination order: successor cursor after deletion · case 01

The exact josephus elimination order result violates the stated contract at successor cursor after deletion.

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

ROOT CAUSE

The successor cursor after deletion step uses index+1 instead of index.

VERIFIED REPAIR

Use index at the successor cursor after deletion step.

Unsuccessful approach: The partial repair index-1 still violates the successor cursor after deletion invariant.

Case contract

Input [n,k,start], n>0 k>0 0<=start<n; return removal order counting current position as one.

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):
    n,k,start=x
    ring=list(range(n));index=start;out=[]
    for _ in range(n):
     if not ring:break
     index=(index+k-1)%len(ring)
     out.append(ring.pop(index))
     index=index+1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([3, 1, 0], [0, 1, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([1, 2, 0], [0]), ([1, 3, 0], [0]), ([1, 4, 0], [0]), ([1, 5, 0], [0]), ([1, 6, 0], [0])], [([3, 1, 1], [1, 2, 0]), ([3, 2, 0], [1, 0, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([2, 5, 1], [1, 0]), ([2, 6, 0], [1, 0]), ([2, 6, 1], [0, 1]), ([2, 7, 0], [0, 1])], [([3, 1, 2], [2, 0, 1]), ([3, 3, 0], [2, 0, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([3, 4, 1], [1, 0, 2]), ([3, 4, 2], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([3, 5, 1], [2, 0, 1])], [([3, 2, 0], [1, 0, 2]), ([3, 4, 0], [0, 2, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 1, 3], [3, 0, 1, 2]), ([4, 2, 0], [1, 3, 2, 0]), ([4, 2, 1], [2, 0, 3, 1]), ([4, 2, 2], [3, 1, 0, 2])], [([3, 2, 1], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 6, 0], [1, 0, 3, 2]), ([4, 6, 1], [2, 1, 0, 3]), ([4, 6, 2], [3, 2, 1, 0]), ([4, 6, 3], [0, 3, 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, 2, 1][0, 1, 2]Failed
explicit oracle 1[0][0]Passed
explicit oracle 2[6, 4, 3, 5, 8, 0, 9, 10, 7, 1, 2][6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]Failed
explicit oracle 3[0][0]Passed
explicit oracle 4[0][0]Passed
explicit oracle 5[0][0]Passed
explicit oracle 6[0][0]Passed
explicit oracle 7[0][0]Passed

SHA-256 / 8feb502c0fd5b85794d9d180b7bbbe20440c0d5b847a035fd8bdef8d0b361ff2

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):
    n,k,start=x
    ring=list(range(n));index=start;out=[]
    for _ in range(n):
     if not ring:break
     index=(index+k-1)%len(ring)
     out.append(ring.pop(index))
     index=index-1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([3, 1, 0], [0, 1, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([1, 2, 0], [0]), ([1, 3, 0], [0]), ([1, 4, 0], [0]), ([1, 5, 0], [0]), ([1, 6, 0], [0])], [([3, 1, 1], [1, 2, 0]), ([3, 2, 0], [1, 0, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([2, 5, 1], [1, 0]), ([2, 6, 0], [1, 0]), ([2, 6, 1], [0, 1]), ([2, 7, 0], [0, 1])], [([3, 1, 2], [2, 0, 1]), ([3, 3, 0], [2, 0, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([3, 4, 1], [1, 0, 2]), ([3, 4, 2], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([3, 5, 1], [2, 0, 1])], [([3, 2, 0], [1, 0, 2]), ([3, 4, 0], [0, 2, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 1, 3], [3, 0, 1, 2]), ([4, 2, 0], [1, 3, 2, 0]), ([4, 2, 1], [2, 0, 3, 1]), ([4, 2, 2], [3, 1, 0, 2])], [([3, 2, 1], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 6, 0], [1, 0, 3, 2]), ([4, 6, 1], [2, 1, 0, 3]), ([4, 6, 2], [3, 2, 1, 0]), ([4, 6, 3], [0, 3, 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, 2, 1][0, 1, 2]Failed
explicit oracle 1[0][0]Passed
explicit oracle 2[6, 2, 10, 8, 7, 9, 1, 5, 0, 3, 4][6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]Failed
explicit oracle 3[0][0]Passed
explicit oracle 4[0][0]Passed
explicit oracle 5[0][0]Passed
explicit oracle 6[0][0]Passed
explicit oracle 7[0][0]Passed

SHA-256 / 1f94bb7eca0acb16ac58f5342bd8d30ae8cb76d17daea24bf7c05a7c16bcec44

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):
    n,k,start=x
    ring=list(range(n));index=start;out=[]
    for _ in range(n):
     if not ring:break
     index=(index+k-1)%len(ring)
     out.append(ring.pop(index))
     index=index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([3, 1, 0], [0, 1, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([1, 2, 0], [0]), ([1, 3, 0], [0]), ([1, 4, 0], [0]), ([1, 5, 0], [0]), ([1, 6, 0], [0])], [([3, 1, 1], [1, 2, 0]), ([3, 2, 0], [1, 0, 2]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([2, 5, 1], [1, 0]), ([2, 6, 0], [1, 0]), ([2, 6, 1], [0, 1]), ([2, 7, 0], [0, 1])], [([3, 1, 2], [2, 0, 1]), ([3, 3, 0], [2, 0, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([3, 4, 1], [1, 0, 2]), ([3, 4, 2], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([3, 5, 1], [2, 0, 1])], [([3, 2, 0], [1, 0, 2]), ([3, 4, 0], [0, 2, 1]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 1, 3], [3, 0, 1, 2]), ([4, 2, 0], [1, 3, 2, 0]), ([4, 2, 1], [2, 0, 3, 1]), ([4, 2, 2], [3, 1, 0, 2])], [([3, 2, 1], [2, 1, 0]), ([3, 5, 0], [1, 2, 0]), ([1, 1, 0], [0]), ([11, 8, 10], [6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]), ([4, 6, 0], [1, 0, 3, 2]), ([4, 6, 1], [2, 1, 0, 3]), ([4, 6, 2], [3, 2, 1, 0]), ([4, 6, 3], [0, 3, 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, 2][0, 1, 2]Passed
explicit oracle 1[0][0]Passed
explicit oracle 2[6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7][6, 3, 1, 0, 2, 5, 9, 8, 4, 10, 7]Passed
explicit oracle 3[0][0]Passed
explicit oracle 4[0][0]Passed
explicit oracle 5[0][0]Passed
explicit oracle 6[0][0]Passed
explicit oracle 7[0][0]Passed

SHA-256 / b015f78adacb173e1b5f4bd7e31ba3b48f51700143718a6191d729ed202d4126

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

Case digest / ccc0b228a0d6827ea80e9471f8516f2098a098c793857eae898e178cbd94a517