{"abstract":"Only references with final carry 0 or 5 get the right check digit.","category":"Check-digit algorithms","checks":8,"contract":"Swiss ESR/QR reference check digit (modulo 10 recursive): spaces ignored, nonempty ASCII digits required (else None). carry starts at 0 and for each digit becomes T[(carry + digit) mod 10] with T = 0,9,4,6,8,2,7,1,3,5; the check digit is (10 - carry) mod 10.","evaluation_group":"w2-check_digit_algorithms-esr-mod10-recursive","failed_approach":"Returning 9 - carry is the nines complement and is off by one.","family":"w2-check_digit_algorithms-esr-mod10-recursive-final-complement","id":"FA-72836","implementations":{"attempt":{"sha256":"a925031b38b25330b3b942185560fca268964c862fc41f22e1856939945aadb6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    T = [0, 9, 4, 6, 8, 2, 7, 1, 3, 5]\n    t = s.replace(' ', '')\n    if not t or not t.isascii() or not t.isdigit():\n        return None\n    carry = 0\n    for ch in t:\n        carry = T[(carry + int(ch)) % 10]\n    return 9 - carry\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"74553352741408306\"]', ['74553352741408306'], 2], ['regression [\"53572\"]', ['53572'], 8], ['partial-repair [\"2077434195614\"]', ['2077434195614'], 0], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"394430878867088735677979\"]', ['394430878867088735677979'], 0], ['control [\"45013905312\"]', ['45013905312'], 1], ['control [\"1620895357382317345\"]', ['1620895357382317345'], 4]], [['regression [\"1620895357382317345\"]', ['1620895357382317345'], 4], ['regression [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"53572\"]', ['53572'], 8], ['partial-repair [\"45013905312\"]', ['45013905312'], 1], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"80\"]', ['80'], 4]], [['regression [\"80\"]', ['80'], 4], ['regression [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"79703713605975\"]', ['79703713605975'], 0], ['control [\"06826\"]', ['06826'], 2]], [['regression [\"06826\"]', ['06826'], 2], ['regression [\"06830652810379\"]', ['06830652810379'], 4], ['partial-repair [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"846437545686321455\"]', ['846437545686321455'], 0], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4\"]', ['4'], 2], ['control [\"42721685367\"]', ['42721685367'], 1]], [['regression [\"58511\"]', ['58511'], 9], ['regression [\"4\"]', ['4'], 2], ['partial-repair [\"79703713605975\"]', ['79703713605975'], 0], ['partial-repair [\"06826\"]', ['06826'], 2], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"112533096471891526511740\"]', ['112533096471891526511740'], 6], ['control [\"423566969570148799170\"]', ['423566969570148799170'], 9]]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"ecb3de391b44d7efb3d6b315018c8e757ceec1b63eb8b7c94b4b5cbb854c7a3e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    T = [0, 9, 4, 6, 8, 2, 7, 1, 3, 5]\n    t = s.replace(' ', '')\n    if not t or not t.isascii() or not t.isdigit():\n        return None\n    carry = 0\n    for ch in t:\n        carry = T[(carry + int(ch)) % 10]\n    return carry\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"74553352741408306\"]', ['74553352741408306'], 2], ['regression [\"53572\"]', ['53572'], 8], ['partial-repair [\"2077434195614\"]', ['2077434195614'], 0], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"394430878867088735677979\"]', ['394430878867088735677979'], 0], ['control [\"45013905312\"]', ['45013905312'], 1], ['control [\"1620895357382317345\"]', ['1620895357382317345'], 4]], [['regression [\"1620895357382317345\"]', ['1620895357382317345'], 4], ['regression [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"53572\"]', ['53572'], 8], ['partial-repair [\"45013905312\"]', ['45013905312'], 1], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"80\"]', ['80'], 4]], [['regression [\"80\"]', ['80'], 4], ['regression [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"79703713605975\"]', ['79703713605975'], 0], ['control [\"06826\"]', ['06826'], 2]], [['regression [\"06826\"]', ['06826'], 2], ['regression [\"06830652810379\"]', ['06830652810379'], 4], ['partial-repair [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"846437545686321455\"]', ['846437545686321455'], 0], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4\"]', ['4'], 2], ['control [\"42721685367\"]', ['42721685367'], 1]], [['regression [\"58511\"]', ['58511'], 9], ['regression [\"4\"]', ['4'], 2], ['partial-repair [\"79703713605975\"]', ['79703713605975'], 0], ['partial-repair [\"06826\"]', ['06826'], 2], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"112533096471891526511740\"]', ['112533096471891526511740'], 6], ['control [\"423566969570148799170\"]', ['423566969570148799170'], 9]]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"095221a1e3ae857a0a514d24deb8e820f3e68d6743a103235d1a0442d49ce0c4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    T = [0, 9, 4, 6, 8, 2, 7, 1, 3, 5]\n    t = s.replace(' ', '')\n    if not t or not t.isascii() or not t.isdigit():\n        return None\n    carry = 0\n    for ch in t:\n        carry = T[(carry + int(ch)) % 10]\n    return (10 - carry) % 10\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"74553352741408306\"]', ['74553352741408306'], 2], ['regression [\"53572\"]', ['53572'], 8], ['partial-repair [\"2077434195614\"]', ['2077434195614'], 0], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"394430878867088735677979\"]', ['394430878867088735677979'], 0], ['control [\"45013905312\"]', ['45013905312'], 1], ['control [\"1620895357382317345\"]', ['1620895357382317345'], 4]], [['regression [\"1620895357382317345\"]', ['1620895357382317345'], 4], ['regression [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"53572\"]', ['53572'], 8], ['partial-repair [\"45013905312\"]', ['45013905312'], 1], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"80\"]', ['80'], 4]], [['regression [\"80\"]', ['80'], 4], ['regression [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"29066637371762928589407375\"]', ['29066637371762928589407375'], 8], ['partial-repair [\"4577034845604675\"]', ['4577034845604675'], 7], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"79703713605975\"]', ['79703713605975'], 0], ['control [\"06826\"]', ['06826'], 2]], [['regression [\"06826\"]', ['06826'], 2], ['regression [\"06830652810379\"]', ['06830652810379'], 4], ['partial-repair [\"795943004839078191062840\"]', ['795943004839078191062840'], 4], ['partial-repair [\"846437545686321455\"]', ['846437545686321455'], 0], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"\"]', [''], None], ['control [\"4\"]', ['4'], 2], ['control [\"42721685367\"]', ['42721685367'], 1]], [['regression [\"58511\"]', ['58511'], 9], ['regression [\"4\"]', ['4'], 2], ['partial-repair [\"79703713605975\"]', ['79703713605975'], 0], ['partial-repair [\"06826\"]', ['06826'], 2], ['control [\"\"]', [''], None], ['control [\"12 ab\"]', ['12 ab'], None], ['control [\"112533096471891526511740\"]', ['112533096471891526511740'], 6], ['control [\"423566969570148799170\"]', ['423566969570148799170'], 9]]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-check_digit_algorithms-esr-mod10-recursive-final-complement","generated_at":"2026-09-29T14:48:42.083569+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Payment slips carry a recursive mod-10 reference that billing systems regenerate for reconciliation.","repair":"Return (10 - carry) % 10.","root_cause":"The final carry is returned without taking its ten-complement.","sha256":"99b911aa6fe0cde0df78604bd0dc58ab64a5e0cc55c81b7d4f953fd743726d18","title":"ESR returns the carry as the check digit · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.132,"exit_code":1,"observations":[{"actual":1,"check":"regression [\"74553352741408306\"]","expected":2,"passed":false},{"actual":7,"check":"regression [\"53572\"]","expected":8,"passed":false},{"actual":9,"check":"partial-repair [\"2077434195614\"]","expected":0,"passed":false},{"actual":null,"check":"control [\"\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"12 ab\"]","expected":null,"passed":true},{"actual":9,"check":"control [\"394430878867088735677979\"]","expected":0,"passed":false},{"actual":0,"check":"control [\"45013905312\"]","expected":1,"passed":false},{"actual":3,"check":"control [\"1620895357382317345\"]","expected":4,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"74553352741408306\\\"]\", \"actual\": 1, \"expected\": 2, \"passed\": false}, {\"check\": \"regression [\\\"53572\\\"]\", \"actual\": 7, \"expected\": 8, \"passed\": false}, {\"check\": \"partial-repair [\\\"2077434195614\\\"]\", \"actual\": 9, \"expected\": 0, \"passed\": false}, {\"check\": \"control [\\\"\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"12 ab\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"394430878867088735677979\\\"]\", \"actual\": 9, \"expected\": 0, \"passed\": false}, {\"check\": \"control [\\\"45013905312\\\"]\", \"actual\": 0, \"expected\": 1, \"passed\": false}, {\"check\": \"control [\\\"1620895357382317345\\\"]\", \"actual\": 3, \"expected\": 4, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.873,"exit_code":1,"observations":[{"actual":8,"check":"regression [\"74553352741408306\"]","expected":2,"passed":false},{"actual":2,"check":"regression [\"53572\"]","expected":8,"passed":false},{"actual":0,"check":"partial-repair [\"2077434195614\"]","expected":0,"passed":true},{"actual":null,"check":"control [\"\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"12 ab\"]","expected":null,"passed":true},{"actual":0,"check":"control [\"394430878867088735677979\"]","expected":0,"passed":true},{"actual":9,"check":"control [\"45013905312\"]","expected":1,"passed":false},{"actual":6,"check":"control [\"1620895357382317345\"]","expected":4,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"74553352741408306\\\"]\", \"actual\": 8, \"expected\": 2, \"passed\": false}, {\"check\": \"regression [\\\"53572\\\"]\", \"actual\": 2, \"expected\": 8, \"passed\": false}, {\"check\": \"partial-repair [\\\"2077434195614\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"12 ab\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"394430878867088735677979\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"45013905312\\\"]\", \"actual\": 9, \"expected\": 1, \"passed\": false}, {\"check\": \"control [\\\"1620895357382317345\\\"]\", \"actual\": 6, \"expected\": 4, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.323,"exit_code":0,"observations":[{"actual":2,"check":"regression [\"74553352741408306\"]","expected":2,"passed":true},{"actual":8,"check":"regression [\"53572\"]","expected":8,"passed":true},{"actual":0,"check":"partial-repair [\"2077434195614\"]","expected":0,"passed":true},{"actual":null,"check":"control [\"\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"12 ab\"]","expected":null,"passed":true},{"actual":0,"check":"control [\"394430878867088735677979\"]","expected":0,"passed":true},{"actual":1,"check":"control [\"45013905312\"]","expected":1,"passed":true},{"actual":4,"check":"control [\"1620895357382317345\"]","expected":4,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"74553352741408306\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"regression [\\\"53572\\\"]\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"partial-repair [\\\"2077434195614\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"12 ab\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"394430878867088735677979\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"45013905312\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"control [\\\"1620895357382317345\\\"]\", \"actual\": 4, \"expected\": 4, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}