FAILURE MAP
← Case archive

FA-72596 / Check-digit algorithms / Open access

Second control digit uses the supplied first control digit · case 01

When the first control digit is mistyped, the reported expected second control digit is also wrong.

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

ROOT CAUSE

k2 is computed over the ten supplied digits, trusting digit 10 instead of the computed k1.

THE FAILURE

k2 is computed over the ten supplied digits, trusting digit 10 instead of the computed k1.

Unsuccessful approach: Omitting digit 10 from the k2 sum drops the weight-2 term entirely.

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 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[:10])
    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 ["15068218891"]', ['15068218891'], [1, 8, False]], ['regression ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]], ['control ["08042619712"]', ['08042619712'], [5, 3, False]]], [['regression ["26096688213"]', ['26096688213'], [7, 9, False]], ['regression ["08042619712"]', ['08042619712'], [5, 3, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]], ['control ["07030971548"]', ['07030971548'], [0, 1, False]]], [['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["20127609775"]', ['20127609775'], [4, 9, False]], ['partial-repair ["23057551053"]', ['23057551053'], [7, 0, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]]], [['regression ["23057551053"]', ['23057551053'], [7, 0, False]], ['regression ["13128514961"]', ['13128514961'], 'unassignable'], ['partial-repair ["13094093660"]', ['13094093660'], [4, 8, False]], ['partial-repair ["27043193556"]', ['27043193556'], [1, 7, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed']], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["27043193556"]', ['27043193556'], [1, 7, False]], ['partial-repair ["10122564665"]', ['10122564665'], [4, 4, False]], ['partial-repair ["23021493559"]', ['23021493559'], [9, 7, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed']]]
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 ["15068218891"][1, 3, False][1, 8, False]Failed
regression ["12026119886"][2, 8, False][2, 9, False]Failed
control ["05077807892"]unassignableunassignablePassed
control ["09117682532"]unassignableunassignablePassed
control ["1507650056"]malformedmalformedPassed
control ["1507650056a"]malformedmalformedPassed
control ["00000000000"][0, 0, True][0, 0, True]Passed
control ["08042619712"][5, 0, False][5, 3, False]Failed

SHA-256 / 47d81c30dab55ef5a3530e8521f69ae634d5b41028aed21ea9b2544a8a4b4eb0

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 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])
    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 ["15068218891"]', ['15068218891'], [1, 8, False]], ['regression ["12026119886"]', ['12026119886'], [2, 9, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]], ['control ["08042619712"]', ['08042619712'], [5, 3, False]]], [['regression ["26096688213"]', ['26096688213'], [7, 9, False]], ['regression ["08042619712"]', ['08042619712'], [5, 3, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]], ['control ["07030971548"]', ['07030971548'], [0, 1, False]]], [['regression ["12060326049"]', ['12060326049'], [0, 0, False]], ['regression ["20127609775"]', ['20127609775'], [4, 9, False]], ['partial-repair ["23057551053"]', ['23057551053'], [7, 0, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed'], ['control ["00000000000"]', ['00000000000'], [0, 0, True]]], [['regression ["23057551053"]', ['23057551053'], [7, 0, False]], ['regression ["13128514961"]', ['13128514961'], 'unassignable'], ['partial-repair ["13094093660"]', ['13094093660'], [4, 8, False]], ['partial-repair ["27043193556"]', ['27043193556'], [1, 7, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed']], [['regression ["15013338686"]', ['15013338686'], [0, 1, False]], ['regression ["27043193556"]', ['27043193556'], [1, 7, False]], ['partial-repair ["10122564665"]', ['10122564665'], [4, 4, False]], ['partial-repair ["23021493559"]', ['23021493559'], [9, 7, False]], ['control ["05077807892"]', ['05077807892'], 'unassignable'], ['control ["09117682532"]', ['09117682532'], 'unassignable'], ['control ["1507650056"]', ['1507650056'], 'malformed'], ['control ["1507650056a"]', ['1507650056a'], 'malformed']]]
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 ["15068218891"]unassignable[1, 8, False]Failed
regression ["12026119886"][2, 2, False][2, 9, False]Failed
control ["05077807892"]unassignableunassignablePassed
control ["09117682532"]unassignableunassignablePassed
control ["1507650056"]malformedmalformedPassed
control ["1507650056a"]malformedmalformedPassed
control ["00000000000"][0, 0, True][0, 0, True]Passed
control ["08042619712"][5, 2, False][5, 3, False]Failed

SHA-256 / b73b02548b543ab06395b9d6a591b6f3f34e2e54c702fe609556233308044473

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

Case digest / 680c95a73f24eaec19e0dcbd538eb69fce69857e8c2aab41a3a6ebddcb249531