FA-72601 / Check-digit algorithms / Open access
Control digit eleven is not mapped to zero · case 01
Numbers whose weighted sum is a multiple of 11 produce control value 11.
ROOT CAUSE
ctrl returns 11 - 0 = 11 unchanged.
VERIFIED REPAIR
Map an 11 result to control digit 0.
Unsuccessful approach: Folding with % 10 turns 11 into 1 and also hides the unassignable value 10.
Case contract
Norwegian-style 11-digit national identity number with two mod-11 control digits. k1 uses weights 3,7,6,1,8,9,4,5,2 on digits 1-9; k2 uses 5,4,3,2,7,6,5,4,3,2 on digits 1-9 followed by the computed k1. Each is 11 - (sum mod 11) with 11 mapped to 0; a value of 10 means the base number is "unassignable". Non-11-digit input is "malformed". Return [k1, k2, whether digits 10 and 11 equal k1 and k2].
Why this case matters
Population registers validate national identity numbers and report which control digit disagrees.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 11 or not s.isascii() or not s.isdigit():
return 'malformed'
d = [int(ch) for ch in s]
def ctrl(ws, ds):
r = 11 - sum(w * x for w, x in zip(ws, ds)) % 11
return r
k1 = ctrl([3, 7, 6, 1, 8, 9, 4, 5, 2], d[:9])
if k1 == 10:
return 'unassignable'
k2 = ctrl([5, 4, 3, 2, 7, 6, 5, 4, 3, 2], d[:9] + [k1])
if k2 == 10:
return 'unassignable'
return [k1, k2, d[9] == k1 and d[10] == k2]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['partial-repair ["28098179001"]', ['28098179001'], 'unassignable'], ['control ["15068218891"]', ['15068218891'], [1, 8, False]], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["09117682532"]', ['09117682532'], 'unassignable'], ['partial-repair ["07030971548"]', ['07030971548'], [0, 1, False]], ['control ["20127609775"]', ['20127609775'], [4, 9, False]], ['control ["13094093660"]', ['13094093660'], [4, 8, False]], ['control ["27043193556"]', ['27043193556'], [1, 7, False]], ['control ["13114336351"]', ['13114336351'], [5, 6, False]]], [['regression ["23056929360"]', ['23056929360'], [0, 4, False]], ['regression ["20063518913"]', ['20063518913'], [0, 6, False]], ['partial-repair ["13128514961"]', ['13128514961'], 'unassignable'], ['partial-repair ["15013338686"]', ['15013338686'], [0, 1, False]], ['control ["23021493559"]', ['23021493559'], [9, 7, False]], ['control ["18115340042"]', ['18115340042'], [5, 7, False]], ['control ["23030552606"]', ['23030552606'], [4, 4, False]], ['control ["26042158718"]', ['26042158718'], [3, 8, False]]], [['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["01117093517"]', ['01117093517'], [1, 0, False]], ['partial-repair ["23056929360"]', ['23056929360'], [0, 4, False]], ['control ["15076500565"]', ['15076500565'], [6, 5, True]], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["01129955131"]', ['01129955131'], [5, 1, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["00000000000"]', ['00000000000'], [0, 0, True]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]], ['control ["08042619712"]', ['08042619712'], [5, 3, False]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["12060326049"] | [11, 11, False] | [0, 0, False] | Failed |
| regression ["07030971548"] | [11, 1, False] | [0, 1, False] | Failed |
| partial-repair ["05077807892"] | unassignable | unassignable | Passed |
| partial-repair ["28098179001"] | unassignable | unassignable | Passed |
| control ["15068218891"] | [1, 8, False] | [1, 8, False] | Passed |
| control ["12026119886"] | [2, 9, False] | [2, 9, False] | Passed |
| control ["03060130066"] | [7, 7, False] | [7, 7, False] | Passed |
| control ["26096688213"] | [7, 9, False] | [7, 9, False] | Passed |
SHA-256 / 9baad1763ae10d4015d4189008ac4f5645885e7a5a6d5adbd68cd2c0b2b8dda8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 11 or not s.isascii() or not s.isdigit():
return 'malformed'
d = [int(ch) for ch in s]
def ctrl(ws, ds):
r = 11 - sum(w * x for w, x in zip(ws, ds)) % 11
return r % 10
k1 = ctrl([3, 7, 6, 1, 8, 9, 4, 5, 2], d[:9])
if k1 == 10:
return 'unassignable'
k2 = ctrl([5, 4, 3, 2, 7, 6, 5, 4, 3, 2], d[:9] + [k1])
if k2 == 10:
return 'unassignable'
return [k1, k2, d[9] == k1 and d[10] == k2]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['partial-repair ["28098179001"]', ['28098179001'], 'unassignable'], ['control ["15068218891"]', ['15068218891'], [1, 8, False]], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["09117682532"]', ['09117682532'], 'unassignable'], ['partial-repair ["07030971548"]', ['07030971548'], [0, 1, False]], ['control ["20127609775"]', ['20127609775'], [4, 9, False]], ['control ["13094093660"]', ['13094093660'], [4, 8, False]], ['control ["27043193556"]', ['27043193556'], [1, 7, False]], ['control ["13114336351"]', ['13114336351'], [5, 6, False]]], [['regression ["23056929360"]', ['23056929360'], [0, 4, False]], ['regression ["20063518913"]', ['20063518913'], [0, 6, False]], ['partial-repair ["13128514961"]', ['13128514961'], 'unassignable'], ['partial-repair ["15013338686"]', ['15013338686'], [0, 1, False]], ['control ["23021493559"]', ['23021493559'], [9, 7, False]], ['control ["18115340042"]', ['18115340042'], [5, 7, False]], ['control ["23030552606"]', ['23030552606'], [4, 4, False]], ['control ["26042158718"]', ['26042158718'], [3, 8, False]]], [['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["01117093517"]', ['01117093517'], [1, 0, False]], ['partial-repair ["23056929360"]', ['23056929360'], [0, 4, False]], ['control ["15076500565"]', ['15076500565'], [6, 5, True]], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["01129955131"]', ['01129955131'], [5, 1, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["00000000000"]', ['00000000000'], [0, 0, True]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]], ['control ["08042619712"]', ['08042619712'], [5, 3, False]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["12060326049"] | [1, 9, False] | [0, 0, False] | Failed |
| regression ["07030971548"] | [1, 0, False] | [0, 1, False] | Failed |
| partial-repair ["05077807892"] | [0, 4, False] | unassignable | Failed |
| partial-repair ["28098179001"] | [3, 0, False] | unassignable | Failed |
| control ["15068218891"] | [1, 8, False] | [1, 8, False] | Passed |
| control ["12026119886"] | [2, 9, False] | [2, 9, False] | Passed |
| control ["03060130066"] | [7, 7, False] | [7, 7, False] | Passed |
| control ["26096688213"] | [7, 9, False] | [7, 9, False] | Passed |
SHA-256 / 3fe18fdedc78b629b72c772df9cdbcb888d51edbe1f0cc2bbad60341fcf210a6
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
if len(s) != 11 or not s.isascii() or not s.isdigit():
return 'malformed'
d = [int(ch) for ch in s]
def ctrl(ws, ds):
r = 11 - sum(w * x for w, x in zip(ws, ds)) % 11
return 0 if r == 11 else r
k1 = ctrl([3, 7, 6, 1, 8, 9, 4, 5, 2], d[:9])
if k1 == 10:
return 'unassignable'
k2 = ctrl([5, 4, 3, 2, 7, 6, 5, 4, 3, 2], d[:9] + [k1])
if k2 == 10:
return 'unassignable'
return [k1, k2, d[9] == k1 and d[10] == k2]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['partial-repair ["28098179001"]', ['28098179001'], 'unassignable'], ['control ["15068218891"]', ['15068218891'], [1, 8, False]], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["09117682532"]', ['09117682532'], 'unassignable'], ['partial-repair ["07030971548"]', ['07030971548'], [0, 1, False]], ['control ["20127609775"]', ['20127609775'], [4, 9, False]], ['control ["13094093660"]', ['13094093660'], [4, 8, False]], ['control ["27043193556"]', ['27043193556'], [1, 7, False]], ['control ["13114336351"]', ['13114336351'], [5, 6, False]]], [['regression ["23056929360"]', ['23056929360'], [0, 4, False]], ['regression ["20063518913"]', ['20063518913'], [0, 6, False]], ['partial-repair ["13128514961"]', ['13128514961'], 'unassignable'], ['partial-repair ["15013338686"]', ['15013338686'], [0, 1, False]], ['control ["23021493559"]', ['23021493559'], [9, 7, False]], ['control ["18115340042"]', ['18115340042'], [5, 7, False]], ['control ["23030552606"]', ['23030552606'], [4, 4, False]], ['control ["26042158718"]', ['26042158718'], [3, 8, False]]], [['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["07030971548"]', ['07030971548'], [0, 1, False]], ['partial-repair ["01117093517"]', ['01117093517'], [1, 0, False]], ['partial-repair ["23056929360"]', ['23056929360'], [0, 4, False]], ['control ["15076500565"]', ['15076500565'], [6, 5, True]], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["01129955131"]', ['01129955131'], [5, 1, False]]], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["18117616591"]', ['18117616591'], [0, 5, False]], ['partial-repair ["00000000000"]', ['00000000000'], [0, 0, True]], ['partial-repair ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["03060130066"]', ['03060130066'], [7, 7, False]], ['control ["26096688213"]', ['26096688213'], [7, 9, False]], ['control ["08042619712"]', ['08042619712'], [5, 3, False]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["12060326049"] | [0, 0, False] | [0, 0, False] | Passed |
| regression ["07030971548"] | [0, 1, False] | [0, 1, False] | Passed |
| partial-repair ["05077807892"] | unassignable | unassignable | Passed |
| partial-repair ["28098179001"] | unassignable | unassignable | Passed |
| control ["15068218891"] | [1, 8, False] | [1, 8, False] | Passed |
| control ["12026119886"] | [2, 9, False] | [2, 9, False] | Passed |
| control ["03060130066"] | [7, 7, False] | [7, 7, False] | Passed |
| control ["26096688213"] | [7, 9, False] | [7, 9, False] | Passed |
SHA-256 / 9ff272821b8c17f8855310eaa7375e4f0e8dea19a2ea9652c4cb6cbe3cff1502
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:39.933072+00:00.
Case digest / d5e365dc954764fbf80e68c8c5cff262954629def77b13cd911bc7d72ea65400