FAILURE MAP
← Case archive

FA-72811 / Check-digit algorithms / Open access

Bank-slip mod 11 cycles weights 2 to 7 · case 01

Slips longer than six digits receive the wrong verifying digit.

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

ROOT CAUSE

The weights wrap after 7 (2 + i % 6), the cycle used by other mod-11 schemes.

VERIFIED REPAIR

Cycle the weights through 2..9 (2 + i % 8).

Unsuccessful approach: Cycling through 2..10 keeps one weight too many.

Case contract

Bank-slip style mod-11 verifying digit: nonempty ASCII digits (else None); weights 2,3,...,9 cycle from the rightmost digit; r = 11 - sum mod 11; results 10 and 11 are replaced by 1.

Why this case matters

Payment slip barcodes carry a general verifying digit that banks recompute on capture.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    if not s or not s.isascii() or not s.isdigit():
        return None
    total = 0
    for i, ch in enumerate(reversed(s)):
        total += int(ch) * (2 + i % 6)
    r = 11 - total % 11
    return 1 if r in (10, 11) else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["067817050276532142767980812420339104011"]', ['067817050276532142767980812420339104011'], 1], ['regression ["81787654"]', ['81787654'], 5], ['partial-repair ["19275955179485910051680234501004684803"]', ['19275955179485910051680234501004684803'], 1], ['partial-repair ["4216186312776190006424731500839778176090"]', ['4216186312776190006424731500839778176090'], 9], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9]], [['regression ["0154413110088423"]', ['0154413110088423'], 4], ['regression ["2265387292381697"]', ['2265387292381697'], 4], ['partial-repair ["157141363073674774805"]', ['157141363073674774805'], 2], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1]], [['regression ["32390980174642183951992567"]', ['32390980174642183951992567'], 6], ['regression ["883588303"]', ['883588303'], 1], ['partial-repair ["31028572572652095"]', ['31028572572652095'], 8], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1]], [['regression ["1013803677685407598527336083735651"]', ['1013803677685407598527336083735651'], 1], ['regression ["90636853841379"]', ['90636853841379'], 8], ['partial-repair ["541856920526325212396079880824962283"]', ['541856920526325212396079880824962283'], 9], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None]], [['regression ["866534787261435696309320"]', ['866534787261435696309320'], 1], ['regression ["59608070035358359099925603574938148494060"]', ['59608070035358359099925603574938148494060'], 2], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, 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
regression ["067817050276532142767980812420339104011"]21Failed
regression ["81787654"]45Failed
partial-repair ["19275955179485910051680234501004684803"]11Passed
partial-repair ["4216186312776190006424731500839778176090"]79Failed
control ["20974"]11Passed
control ["54"]11Passed
control ["0"]11Passed
control ["1"]99Passed

SHA-256 / 26f69480d48422fbd5e8dfc98b9f3f37f2e69539564c81bfb1892c0e42ec94fa

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    if not s or not s.isascii() or not s.isdigit():
        return None
    total = 0
    for i, ch in enumerate(reversed(s)):
        total += int(ch) * (2 + i % 9)
    r = 11 - total % 11
    return 1 if r in (10, 11) else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["067817050276532142767980812420339104011"]', ['067817050276532142767980812420339104011'], 1], ['regression ["81787654"]', ['81787654'], 5], ['partial-repair ["19275955179485910051680234501004684803"]', ['19275955179485910051680234501004684803'], 1], ['partial-repair ["4216186312776190006424731500839778176090"]', ['4216186312776190006424731500839778176090'], 9], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9]], [['regression ["0154413110088423"]', ['0154413110088423'], 4], ['regression ["2265387292381697"]', ['2265387292381697'], 4], ['partial-repair ["157141363073674774805"]', ['157141363073674774805'], 2], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1]], [['regression ["32390980174642183951992567"]', ['32390980174642183951992567'], 6], ['regression ["883588303"]', ['883588303'], 1], ['partial-repair ["31028572572652095"]', ['31028572572652095'], 8], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1]], [['regression ["1013803677685407598527336083735651"]', ['1013803677685407598527336083735651'], 1], ['regression ["90636853841379"]', ['90636853841379'], 8], ['partial-repair ["541856920526325212396079880824962283"]', ['541856920526325212396079880824962283'], 9], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None]], [['regression ["866534787261435696309320"]', ['866534787261435696309320'], 1], ['regression ["59608070035358359099925603574938148494060"]', ['59608070035358359099925603574938148494060'], 2], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, 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
regression ["067817050276532142767980812420339104011"]11Passed
regression ["81787654"]55Passed
partial-repair ["19275955179485910051680234501004684803"]61Failed
partial-repair ["4216186312776190006424731500839778176090"]19Failed
control ["20974"]11Passed
control ["54"]11Passed
control ["0"]11Passed
control ["1"]99Passed

SHA-256 / afb59a7151990f786be70c8d27af2d415e3e58ea6750a6c702cef76d14094bb0

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    if not s or not s.isascii() or not s.isdigit():
        return None
    total = 0
    for i, ch in enumerate(reversed(s)):
        total += int(ch) * (2 + i % 8)
    r = 11 - total % 11
    return 1 if r in (10, 11) else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["067817050276532142767980812420339104011"]', ['067817050276532142767980812420339104011'], 1], ['regression ["81787654"]', ['81787654'], 5], ['partial-repair ["19275955179485910051680234501004684803"]', ['19275955179485910051680234501004684803'], 1], ['partial-repair ["4216186312776190006424731500839778176090"]', ['4216186312776190006424731500839778176090'], 9], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9]], [['regression ["0154413110088423"]', ['0154413110088423'], 4], ['regression ["2265387292381697"]', ['2265387292381697'], 4], ['partial-repair ["157141363073674774805"]', ['157141363073674774805'], 2], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1]], [['regression ["32390980174642183951992567"]', ['32390980174642183951992567'], 6], ['regression ["883588303"]', ['883588303'], 1], ['partial-repair ["31028572572652095"]', ['31028572572652095'], 8], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1]], [['regression ["1013803677685407598527336083735651"]', ['1013803677685407598527336083735651'], 1], ['regression ["90636853841379"]', ['90636853841379'], 8], ['partial-repair ["541856920526325212396079880824962283"]', ['541856920526325212396079880824962283'], 9], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None], ['control ["12x"]', ['12x'], None]], [['regression ["866534787261435696309320"]', ['866534787261435696309320'], 1], ['regression ["59608070035358359099925603574938148494060"]', ['59608070035358359099925603574938148494060'], 2], ['control ["00000000"]', ['00000000'], 1], ['control ["20974"]', ['20974'], 1], ['control ["54"]', ['54'], 1], ['control ["0"]', ['0'], 1], ['control ["1"]', ['1'], 9], ['control [""]', [''], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, 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
regression ["067817050276532142767980812420339104011"]11Passed
regression ["81787654"]55Passed
partial-repair ["19275955179485910051680234501004684803"]11Passed
partial-repair ["4216186312776190006424731500839778176090"]99Passed
control ["20974"]11Passed
control ["54"]11Passed
control ["0"]11Passed
control ["1"]99Passed

SHA-256 / c3ff95dc57765ed07806126757f4273597e850356bfdb0d2274fa10a98f413d6

Verification & scope

A deterministic, bounded teaching model of the named scheme under the stated contract; not a certified validator. 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:48:41.791460+00:00.

Case digest / da59d05bc59409aed65753498572e1a96dee133430014805a6e8be2df2032a2e