{"abstract":"Inputs with several unknown digits get a confident single answer.","category":"Check-digit algorithms","checks":8,"contract":"Recover the single unknown digit (marked \"?\") in a Luhn-protected number: input must be at least two characters, ASCII digits and exactly one \"?\" (else None). Return the digit 0-9 that makes the whole number Luhn-valid; when the unknown sits in a doubled position the needed contribution must be mapped back through the doubling map.","contract_signature":"s","evaluation_group":"w2-check_digit_algorithms-luhn-missing-digit","failed_approach":"Rejecting three or more unknowns still answers ambiguous two-unknown inputs.","family":"w2-check_digit_algorithms-luhn-missing-digit-single-unknown-gate","id":"FA-72806","implementations":{"attempt":{"sha256":"ab030f0b098df64033be3138d9ff610b14cf682d3e4bbb9cd76d1698791fe83b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) < 2 or not 1 <= s.count('?') <= 2 or not s.isascii() or not all(c.isdigit() or c == '?' for c in s):\n        return None\n    k = len(s) - 1 - s.index('?')\n    total = 0\n    for i, ch in enumerate(reversed(s)):\n        if ch == '?':\n            continue\n        d = int(ch)\n        if i % 2 == 1:\n            d = d * 2 - 9 if d > 4 else d * 2\n        total += d\n    need = (10 - total % 10) % 10\n    if k % 2 == 1:\n        need = need // 2 if need % 2 == 0 else (need + 9) // 2\n    return need\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"??\"]', ['??'], None], ['control [\"7?850\"]', ['7?850'], 2], ['control [\"766?9906\"]', ['766?9906'], 2], ['control [\"?929942967\"]', ['?929942967'], 1], ['control [\"1519774?1518\"]', ['1519774?1518'], 5], ['control [\"049785409775?16\"]', ['049785409775?16'], 5], ['control [\"475646793469?297\"]', ['475646793469?297'], 0], ['control [\"3077312?96877436\"]', ['3077312?96877436'], 1]], [['regression [\"??\"]', ['??'], None], ['control [\"475646793469?297\"]', ['475646793469?297'], 0], ['control [\"3077312?96877436\"]', ['3077312?96877436'], 1], ['control [\"405529124?1\"]', ['405529124?1'], 9], ['control [\"6?0334555\"]', ['6?0334555'], 3], ['control [\"033?959838019\"]', ['033?959838019'], 2], ['control [\"3102377592002?64\"]', ['3102377592002?64'], 6], ['control [\"08?8016\"]', ['08?8016'], 8]], [['regression [\"??\"]', ['??'], None], ['control [\"3102377592002?64\"]', ['3102377592002?64'], 6], ['control [\"08?8016\"]', ['08?8016'], 8], ['control [\"2288?7\"]', ['2288?7'], 1], ['control [\"1507302?557627\"]', ['1507302?557627'], 8], ['control [\"7992739871?\"]', ['7992739871?'], 3], ['control [\"?9927398713\"]', ['?9927398713'], 7], ['control [\"79927?98713\"]', ['79927?98713'], 3]], [['regression [\"??\"]', ['??'], None], ['control [\"?9927398713\"]', ['?9927398713'], 7], ['control [\"79927?98713\"]', ['79927?98713'], 3], ['control [\"4111111111?11111\"]', ['4111111111?11111'], 1], ['control [\"1\"]', ['1'], None], ['control [\"12a?\"]', ['12a?'], None], ['control [\"?\"]', ['?'], None], ['control [\"?0\"]', ['?0'], 0]], [['regression [\"??\"]', ['??'], None], ['control [\"?\"]', ['?'], None], ['control [\"?0\"]', ['?0'], 0], ['control [\"0?\"]', ['0?'], 0], ['control [\"7?850\"]', ['7?850'], 2], ['control [\"766?9906\"]', ['766?9906'], 2], ['control [\"?929942967\"]', ['?929942967'], 1], ['control [\"1519774?1518\"]', ['1519774?1518'], 5]]]\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":"b3f243be563afc308f384ed9955021683870269e8fb3e1f66522bbcfb06e5c20","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) < 2 or '?' not in s or not s.isascii() or not all(c.isdigit() or c == '?' for c in s):\n        return None\n    k = len(s) - 1 - s.index('?')\n    total = 0\n    for i, ch in enumerate(reversed(s)):\n        if ch == '?':\n            continue\n        d = int(ch)\n        if i % 2 == 1:\n            d = d * 2 - 9 if d > 4 else d * 2\n        total += d\n    need = (10 - total % 10) % 10\n    if k % 2 == 1:\n        need = need // 2 if need % 2 == 0 else (need + 9) // 2\n    return need\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"??\"]', ['??'], None], ['control [\"7?850\"]', ['7?850'], 2], ['control [\"766?9906\"]', ['766?9906'], 2], ['control [\"?929942967\"]', ['?929942967'], 1], ['control [\"1519774?1518\"]', ['1519774?1518'], 5], ['control [\"049785409775?16\"]', ['049785409775?16'], 5], ['control [\"475646793469?297\"]', ['475646793469?297'], 0], ['control [\"3077312?96877436\"]', ['3077312?96877436'], 1]], [['regression [\"??\"]', ['??'], None], ['control [\"475646793469?297\"]', ['475646793469?297'], 0], ['control [\"3077312?96877436\"]', ['3077312?96877436'], 1], ['control [\"405529124?1\"]', ['405529124?1'], 9], ['control [\"6?0334555\"]', ['6?0334555'], 3], ['control [\"033?959838019\"]', ['033?959838019'], 2], ['control [\"3102377592002?64\"]', ['3102377592002?64'], 6], ['control [\"08?8016\"]', ['08?8016'], 8]], [['regression [\"??\"]', ['??'], None], ['control [\"3102377592002?64\"]', ['3102377592002?64'], 6], ['control [\"08?8016\"]', ['08?8016'], 8], ['control [\"2288?7\"]', ['2288?7'], 1], ['control [\"1507302?557627\"]', ['1507302?557627'], 8], ['control [\"7992739871?\"]', ['7992739871?'], 3], ['control [\"?9927398713\"]', ['?9927398713'], 7], ['control [\"79927?98713\"]', ['79927?98713'], 3]], [['regression [\"??\"]', ['??'], None], ['control [\"?9927398713\"]', ['?9927398713'], 7], ['control [\"79927?98713\"]', ['79927?98713'], 3], ['control [\"4111111111?11111\"]', ['4111111111?11111'], 1], ['control [\"1\"]', ['1'], None], ['control [\"12a?\"]', ['12a?'], None], ['control [\"?\"]', ['?'], None], ['control [\"?0\"]', ['?0'], 0]], [['regression [\"??\"]', ['??'], None], ['control [\"?\"]', ['?'], None], ['control [\"?0\"]', ['?0'], 0], ['control [\"0?\"]', ['0?'], 0], ['control [\"7?850\"]', ['7?850'], 2], ['control [\"766?9906\"]', ['766?9906'], 2], ['control [\"?929942967\"]', ['?929942967'], 1], ['control [\"1519774?1518\"]', ['1519774?1518'], 5]]]\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-luhn-missing-digit-single-unknown-gate","generated_at":"2026-09-29T14:48:41.726420+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Customer-service tools reconstruct a smudged or misheard digit of an account number.","root_cause":"The gate only requires that some \"?\" is present.","sha256":"b6cdd49ae8902789d0bdd2d0fdad80bf4c86b454c9108c6a1a2181855a12bd41","title":"Missing-digit recovery answers with two unknowns · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":43.229,"exit_code":1,"observations":[{"actual":0,"check":"regression [\"??\"]","expected":null,"passed":false},{"actual":2,"check":"control [\"7?850\"]","expected":2,"passed":true},{"actual":2,"check":"control [\"766?9906\"]","expected":2,"passed":true},{"actual":1,"check":"control [\"?929942967\"]","expected":1,"passed":true},{"actual":5,"check":"control [\"1519774?1518\"]","expected":5,"passed":true},{"actual":5,"check":"control [\"049785409775?16\"]","expected":5,"passed":true},{"actual":0,"check":"control [\"475646793469?297\"]","expected":0,"passed":true},{"actual":1,"check":"control [\"3077312?96877436\"]","expected":1,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"??\\\"]\", \"actual\": 0, \"expected\": null, \"passed\": false}, {\"check\": \"control [\\\"7?850\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"766?9906\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"?929942967\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"control [\\\"1519774?1518\\\"]\", \"actual\": 5, \"expected\": 5, \"passed\": true}, {\"check\": \"control [\\\"049785409775?16\\\"]\", \"actual\": 5, \"expected\": 5, \"passed\": true}, {\"check\": \"control [\\\"475646793469?297\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"3077312?96877436\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.207,"exit_code":1,"observations":[{"actual":0,"check":"regression [\"??\"]","expected":null,"passed":false},{"actual":2,"check":"control [\"7?850\"]","expected":2,"passed":true},{"actual":2,"check":"control [\"766?9906\"]","expected":2,"passed":true},{"actual":1,"check":"control [\"?929942967\"]","expected":1,"passed":true},{"actual":5,"check":"control [\"1519774?1518\"]","expected":5,"passed":true},{"actual":5,"check":"control [\"049785409775?16\"]","expected":5,"passed":true},{"actual":0,"check":"control [\"475646793469?297\"]","expected":0,"passed":true},{"actual":1,"check":"control [\"3077312?96877436\"]","expected":1,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"??\\\"]\", \"actual\": 0, \"expected\": null, \"passed\": false}, {\"check\": \"control [\\\"7?850\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"766?9906\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"?929942967\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"control [\\\"1519774?1518\\\"]\", \"actual\": 5, \"expected\": 5, \"passed\": true}, {\"check\": \"control [\\\"049785409775?16\\\"]\", \"actual\": 5, \"expected\": 5, \"passed\": true}, {\"check\": \"control [\\\"475646793469?297\\\"]\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control [\\\"3077312?96877436\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}