FAILURE MAP
← Case archive

FA-72536 / Check-digit algorithms / Open access

CUSIP folds doubled values by subtracting nine · case 01

CUSIPs with letters in doubled positions get wrong check digits.

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

ROOT CAUSE

Values are reduced with the Luhn rule v - 9 (if v > 9), which only equals the digit sum below 20; letter values reach 76.

VERIFIED REPAIR

Add v // 10 + v % 10 for every (possibly doubled) value.

Unsuccessful approach: A digital root folds 19 and larger values to a single digit, still differing from the two-digit sum.

Case contract

CUSIP check: nine ASCII characters, the ninth a digit. Payload values: digits face value, A-Z 10-35, * 36, @ 37, # 38 (anything else "malformed"). Every second payload character (1-based even position) is doubled, and the decimal digits of each value are summed. Return [(10 - sum % 10) % 10, whether it equals the ninth digit].

Why this case matters

Clearing and custody systems validate North American security identifiers.

1 / The failure

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

N = 1
observations = []
def solve(s):
    if len(s) != 9 or not s.isascii() or not s[8].isdigit():
        return 'malformed'
    total = 0
    for i, ch in enumerate(s[:8]):
        if ch.isdigit():
            v = int(ch)
        elif 'A' <= ch <= 'Z':
            v = ord(ch) - 55
        elif ch in '*@#':
            v = 36 + '*@#'.index(ch)
        else:
            return 'malformed'
        if i % 2 == 1:
            v *= 2
        total += v - 9 if v > 9 else v
    check = (10 - total % 10) % 10
    return [check, check == int(s[8])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["317997MK3"]', ['317997MK3'], [7, False]], ['regression ["624143L53"]', ['624143L53'], [0, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]], [['regression ["161949AV8"]', ['161949AV8'], [4, False]], ['regression ["523003XR4"]', ['523003XR4'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['partial-repair ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]]], [['regression ["088857YN7"]', ['088857YN7'], [1, False]], ['regression ["462107IA0"]', ['462107IA0'], [3, False]], ['partial-repair ["7WKYMG#Y7"]', ['7WKYMG#Y7'], [3, False]], ['partial-repair ["68389X105"]', ['68389X105'], [5, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed']], [['regression ["V0SRK56U5"]', ['V0SRK56U5'], [2, False]], ['regression ["U243EIXI1"]', ['U243EIXI1'], [4, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]]], [['regression ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['regression ["XIXEC2WW3"]', ['XIXEC2WW3'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]]]
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 ["317997MK3"][1, False][7, False]Failed
regression ["624143L53"][1, False][0, False]Failed
partial-repair ["088857YN7"][6, False][1, False]Failed
partial-repair ["6OZ44LI17"][3, False][5, False]Failed
control ["595693682"][0, False][0, False]Passed
control ["445197417"][1, False][1, False]Passed
control ["037833100"][0, True][0, True]Passed
control ["594918104"][4, True][4, True]Passed

SHA-256 / dccf6f79c0873b2e8ee30988bb4f7b921ce016d40443fc97aff5e22078f7411c

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) != 9 or not s.isascii() or not s[8].isdigit():
        return 'malformed'
    total = 0
    for i, ch in enumerate(s[:8]):
        if ch.isdigit():
            v = int(ch)
        elif 'A' <= ch <= 'Z':
            v = ord(ch) - 55
        elif ch in '*@#':
            v = 36 + '*@#'.index(ch)
        else:
            return 'malformed'
        if i % 2 == 1:
            v *= 2
        total += (v - 1) % 9 + 1 if v else 0
    check = (10 - total % 10) % 10
    return [check, check == int(s[8])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["317997MK3"]', ['317997MK3'], [7, False]], ['regression ["624143L53"]', ['624143L53'], [0, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]], [['regression ["161949AV8"]', ['161949AV8'], [4, False]], ['regression ["523003XR4"]', ['523003XR4'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['partial-repair ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]]], [['regression ["088857YN7"]', ['088857YN7'], [1, False]], ['regression ["462107IA0"]', ['462107IA0'], [3, False]], ['partial-repair ["7WKYMG#Y7"]', ['7WKYMG#Y7'], [3, False]], ['partial-repair ["68389X105"]', ['68389X105'], [5, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed']], [['regression ["V0SRK56U5"]', ['V0SRK56U5'], [2, False]], ['regression ["U243EIXI1"]', ['U243EIXI1'], [4, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]]], [['regression ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['regression ["XIXEC2WW3"]', ['XIXEC2WW3'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]]]
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 ["317997MK3"][7, False][7, False]Passed
regression ["624143L53"][0, False][0, False]Passed
partial-repair ["088857YN7"][0, False][1, False]Failed
partial-repair ["6OZ44LI17"][4, False][5, False]Failed
control ["595693682"][0, False][0, False]Passed
control ["445197417"][1, False][1, False]Passed
control ["037833100"][0, True][0, True]Passed
control ["594918104"][4, True][4, True]Passed

SHA-256 / 5859ed764554ff234de9cff481864e8ed9f9deb69e38e9712e0fc96e483f745b

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) != 9 or not s.isascii() or not s[8].isdigit():
        return 'malformed'
    total = 0
    for i, ch in enumerate(s[:8]):
        if ch.isdigit():
            v = int(ch)
        elif 'A' <= ch <= 'Z':
            v = ord(ch) - 55
        elif ch in '*@#':
            v = 36 + '*@#'.index(ch)
        else:
            return 'malformed'
        if i % 2 == 1:
            v *= 2
        total += v // 10 + v % 10
    check = (10 - total % 10) % 10
    return [check, check == int(s[8])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["317997MK3"]', ['317997MK3'], [7, False]], ['regression ["624143L53"]', ['624143L53'], [0, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]], [['regression ["161949AV8"]', ['161949AV8'], [4, False]], ['regression ["523003XR4"]', ['523003XR4'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['partial-repair ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]]], [['regression ["088857YN7"]', ['088857YN7'], [1, False]], ['regression ["462107IA0"]', ['462107IA0'], [3, False]], ['partial-repair ["7WKYMG#Y7"]', ['7WKYMG#Y7'], [3, False]], ['partial-repair ["68389X105"]', ['68389X105'], [5, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]], ['control ["03783310"]', ['03783310'], 'malformed'], ['control ["0378331a0"]', ['0378331a0'], 'malformed']], [['regression ["V0SRK56U5"]', ['V0SRK56U5'], [2, False]], ['regression ["U243EIXI1"]', ['U243EIXI1'], [4, False]], ['partial-repair ["088857YN7"]', ['088857YN7'], [1, False]], ['partial-repair ["6OZ44LI17"]', ['6OZ44LI17'], [5, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]], ['control ["037833101"]', ['037833101'], [0, False]]], [['regression ["KU9BYOL70"]', ['KU9BYOL70'], [2, False]], ['regression ["XIXEC2WW3"]', ['XIXEC2WW3'], [7, False]], ['partial-repair ["6PI3M7KT7"]', ['6PI3M7KT7'], [0, False]], ['control ["0378331a0"]', ['0378331a0'], 'malformed'], ['control ["595693682"]', ['595693682'], [0, False]], ['control ["445197417"]', ['445197417'], [1, False]], ['control ["037833100"]', ['037833100'], [0, True]], ['control ["594918104"]', ['594918104'], [4, True]]]]
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 ["317997MK3"][7, False][7, False]Passed
regression ["624143L53"][0, False][0, False]Passed
partial-repair ["088857YN7"][1, False][1, False]Passed
partial-repair ["6OZ44LI17"][5, False][5, False]Passed
control ["595693682"][0, False][0, False]Passed
control ["445197417"][1, False][1, False]Passed
control ["037833100"][0, True][0, True]Passed
control ["594918104"][4, True][4, True]Passed

SHA-256 / 9608752162620384980f2b8e9573347fdf8c66f7b9801775692ca11665d49749

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

Case digest / 7c6e87d81bdb26e431bd9027cf41dea45dbd43d3fa89a844b767580ffb74e98a