FA-72676 / Check-digit algorithms / Open access
Structured communication expects 00 for a zero remainder · case 01
References whose base is a multiple of 97 are rejected when they carry 97.
ROOT CAUSE
The rule mapping remainder 0 to 97 is missing.
VERIFIED REPAIR
Replace a zero remainder by 97 before comparing.
Unsuccessful approach: Accepting 00 as well as 97 admits the invalid 00 form.
Case contract
Belgian structured payment communication: optional surrounding +++...+++ or ***...*** (matching), slashes ignored, then exactly 12 ASCII digits (else "malformed"). The last two digits must equal the first ten digits mod 97, where a remainder of 0 is written 97. Return whether they match.
Why this case matters
Banks reconcile incoming transfers by validating the structured reference before matching invoices.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
t = s.strip()
if len(t) > 6 and t[:3] == t[-3:] and t[:3] in ('+++', '***'):
t = t[3:-3]
t = t.replace('/', '')
if len(t) != 12 or not t.isascii() or not t.isdigit():
return 'malformed'
r = int(t[:10]) % 97
return r == int(t[10:])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], True], ['control ["***035/9935/50934***"]', ['***035/9935/50934***'], True], ['control ["371789633519"]', ['371789633519'], True], ['control ["+++131/9631/75508+++"]', ['+++131/9631/75508+++'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["***078/2001/09694***"]', ['***078/2001/09694***'], True], ['control ["640618349478"]', ['640618349478'], True], ['control ["+++990/8748/13965+++"]', ['+++990/8748/13965+++'], True], ['control ["***930/2019/38809***"]', ['***930/2019/38809***'], True], ['control ["646994510702"]', ['646994510702'], True]], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["+++001/1569/26676+++"]', ['+++001/1569/26676+++'], True], ['control ["***178/8225/23467***"]', ['***178/8225/23467***'], True], ['control ["123456780211"]', ['123456780211'], True], ['control ["123456780200"]', ['123456780200'], False], ['control ["999999997019"]', ['999999997019'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["999999997000"]', ['999999997000'], False], ['control ["+++123/4567/89002+++"]', ['+++123/4567/89002+++'], True], ['control ["123456789002"]', ['123456789002'], True], ['control ["12345678900"]', ['12345678900'], 'malformed'], ['control ["+++123/4567/8900A+++"]', ['+++123/4567/8900A+++'], 'malformed']], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["***090/9337/55493***"]', ['***090/9337/55493***'], True], ['control ["+++090/9337/55493***"]', ['+++090/9337/55493***'], 'malformed'], ['control ["123456789003"]', ['123456789003'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["000000009797"] | False | True | Failed |
| regression ["000000009700"] | True | False | Failed |
| partial-repair ["000000019400"] | True | False | Failed |
| control ["621266857360"] | True | True | Passed |
| control ["+++865/5789/93879+++"] | True | True | Passed |
| control ["***035/9935/50934***"] | True | True | Passed |
| control ["371789633519"] | True | True | Passed |
| control ["+++131/9631/75508+++"] | True | True | Passed |
SHA-256 / b3f3dafd200afce26c28d823b1426fdaeaa57955238c0c3a93bf6e312d93651a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
t = s.strip()
if len(t) > 6 and t[:3] == t[-3:] and t[:3] in ('+++', '***'):
t = t[3:-3]
t = t.replace('/', '')
if len(t) != 12 or not t.isascii() or not t.isdigit():
return 'malformed'
r = int(t[:10]) % 97
if r == 0:
r = 97
return r == int(t[10:]) or (r == 97 and t[10:] == '00')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], True], ['control ["***035/9935/50934***"]', ['***035/9935/50934***'], True], ['control ["371789633519"]', ['371789633519'], True], ['control ["+++131/9631/75508+++"]', ['+++131/9631/75508+++'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["***078/2001/09694***"]', ['***078/2001/09694***'], True], ['control ["640618349478"]', ['640618349478'], True], ['control ["+++990/8748/13965+++"]', ['+++990/8748/13965+++'], True], ['control ["***930/2019/38809***"]', ['***930/2019/38809***'], True], ['control ["646994510702"]', ['646994510702'], True]], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["+++001/1569/26676+++"]', ['+++001/1569/26676+++'], True], ['control ["***178/8225/23467***"]', ['***178/8225/23467***'], True], ['control ["123456780211"]', ['123456780211'], True], ['control ["123456780200"]', ['123456780200'], False], ['control ["999999997019"]', ['999999997019'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["999999997000"]', ['999999997000'], False], ['control ["+++123/4567/89002+++"]', ['+++123/4567/89002+++'], True], ['control ["123456789002"]', ['123456789002'], True], ['control ["12345678900"]', ['12345678900'], 'malformed'], ['control ["+++123/4567/8900A+++"]', ['+++123/4567/8900A+++'], 'malformed']], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["***090/9337/55493***"]', ['***090/9337/55493***'], True], ['control ["+++090/9337/55493***"]', ['+++090/9337/55493***'], 'malformed'], ['control ["123456789003"]', ['123456789003'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["000000009797"] | True | True | Passed |
| regression ["000000009700"] | True | False | Failed |
| partial-repair ["000000019400"] | True | False | Failed |
| control ["621266857360"] | True | True | Passed |
| control ["+++865/5789/93879+++"] | True | True | Passed |
| control ["***035/9935/50934***"] | True | True | Passed |
| control ["371789633519"] | True | True | Passed |
| control ["+++131/9631/75508+++"] | True | True | Passed |
SHA-256 / a3bc092b610c5b872956a8d34181d9573ba71864c2ff26a06d97f5044bbf2f3c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
t = s.strip()
if len(t) > 6 and t[:3] == t[-3:] and t[:3] in ('+++', '***'):
t = t[3:-3]
t = t.replace('/', '')
if len(t) != 12 or not t.isascii() or not t.isdigit():
return 'malformed'
r = int(t[:10]) % 97
if r == 0:
r = 97
return r == int(t[10:])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], True], ['control ["***035/9935/50934***"]', ['***035/9935/50934***'], True], ['control ["371789633519"]', ['371789633519'], True], ['control ["+++131/9631/75508+++"]', ['+++131/9631/75508+++'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["***078/2001/09694***"]', ['***078/2001/09694***'], True], ['control ["640618349478"]', ['640618349478'], True], ['control ["+++990/8748/13965+++"]', ['+++990/8748/13965+++'], True], ['control ["***930/2019/38809***"]', ['***930/2019/38809***'], True], ['control ["646994510702"]', ['646994510702'], True]], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["+++001/1569/26676+++"]', ['+++001/1569/26676+++'], True], ['control ["***178/8225/23467***"]', ['***178/8225/23467***'], True], ['control ["123456780211"]', ['123456780211'], True], ['control ["123456780200"]', ['123456780200'], False], ['control ["999999997019"]', ['999999997019'], True]], [['regression ["000000019400"]', ['000000019400'], False], ['regression ["000000000097"]', ['000000000097'], True], ['partial-repair ["000000009700"]', ['000000009700'], False], ['control ["999999997000"]', ['999999997000'], False], ['control ["+++123/4567/89002+++"]', ['+++123/4567/89002+++'], True], ['control ["123456789002"]', ['123456789002'], True], ['control ["12345678900"]', ['12345678900'], 'malformed'], ['control ["+++123/4567/8900A+++"]', ['+++123/4567/8900A+++'], 'malformed']], [['regression ["000000009797"]', ['000000009797'], True], ['regression ["000000009700"]', ['000000009700'], False], ['partial-repair ["000000019400"]', ['000000019400'], False], ['control ["***090/9337/55493***"]', ['***090/9337/55493***'], True], ['control ["+++090/9337/55493***"]', ['+++090/9337/55493***'], 'malformed'], ['control ["123456789003"]', ['123456789003'], False], ['control ["621266857360"]', ['621266857360'], True], ['control ["+++865/5789/93879+++"]', ['+++865/5789/93879+++'], 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["000000009797"] | True | True | Passed |
| regression ["000000009700"] | False | False | Passed |
| partial-repair ["000000019400"] | False | False | Passed |
| control ["621266857360"] | True | True | Passed |
| control ["+++865/5789/93879+++"] | True | True | Passed |
| control ["***035/9935/50934***"] | True | True | Passed |
| control ["371789633519"] | True | True | Passed |
| control ["+++131/9631/75508+++"] | True | True | Passed |
SHA-256 / 9644bd47d025c20bf62d7c6fdcafe93c6aabd05ca6d6b3d88dd2c3493ec91c64
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:40.568908+00:00.
Case digest / 4c67fd8c8687f809093e755d43986e9406e3fa439085f0f670381e9c92bf5977