{"abstract":"Most valid VAT numbers are rejected.","category":"Check-digit algorithms","checks":8,"contract":"UK VAT registration number check. Spaces are removed, the text is upper-cased and an optional GB prefix removed; the rest must be 9 ASCII digits (else \"malformed\"). Weights 8..2 apply to the first seven digits; the last two digits form a number c. Return \"mod97\" if (sum + c) is divisible by 97, \"mod9755\" if (sum + c + 55) is, else \"invalid\".","contract_signature":"s","evaluation_group":"w2-check_digit_algorithms-uk-vat","failed_approach":"Adding the two digits is still not the two-digit number.","family":"w2-check_digit_algorithms-uk-vat-check-pair","id":"FA-72701","implementations":{"attempt":{"sha256":"cc9db48f3131c29f81c6173dbf118032e4018641a0856db74a783c1601dccc27","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    t = s.replace(' ', '').upper()\n    if t.startswith('GB'):\n        t = t[2:]\n    if len(t) != 9 or not t.isascii() or not t.isdigit():\n        return 'malformed'\n    total = sum(int(ch) * w for ch, w in zip(t[:7], range(8, 1, -1)))\n    c = int(t[7]) + int(t[8])\n    if (total + c) % 97 == 0:\n        return 'mod97'\n    if (total + c + 55) % 97 == 0:\n        return 'mod9755'\n    return 'invalid'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"GB041839277\"]', ['GB041839277'], 'mod97'], ['regression [\"729236520\"]', ['729236520'], 'mod97'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid'], ['control [\"260407727\"]', ['260407727'], 'invalid'], ['control [\"029331391\"]', ['029331391'], 'invalid']], [['regression [\"GB 029 3313 90\"]', ['GB 029 3313 90'], 'mod97'], ['regression [\"581077575\"]', ['581077575'], 'mod9755'], ['control [\"029331391\"]', ['029331391'], 'invalid'], ['control [\"581077576\"]', ['581077576'], 'invalid'], ['control [\"GB658372602\"]', ['GB658372602'], 'mod97'], ['control [\"GB98078068\"]', ['GB98078068'], 'malformed'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed'], ['control [\"123456789\"]', ['123456789'], 'invalid']], [['regression [\"331553089\"]', ['331553089'], 'mod97'], ['regression [\"GB784073455\"]', ['GB784073455'], 'mod9755'], ['control [\"123456789\"]', ['123456789'], 'invalid'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid'], ['control [\"260407727\"]', ['260407727'], 'invalid']], [['regression [\"155142529\"]', ['155142529'], 'mod9755'], ['regression [\"GB801525174\"]', ['GB801525174'], 'mod97'], ['control [\"260407727\"]', ['260407727'], 'invalid'], ['control [\"029331391\"]', ['029331391'], 'invalid'], ['control [\"581077576\"]', ['581077576'], 'invalid'], ['control [\"GB658372602\"]', ['GB658372602'], 'mod97'], ['control [\"GB98078068\"]', ['GB98078068'], 'malformed'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed']], [['regression [\"GB980780684\"]', ['GB980780684'], 'mod97'], ['regression [\"980 7806 84\"]', ['980 7806 84'], 'mod97'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed'], ['control [\"123456789\"]', ['123456789'], 'invalid'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid']]]\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":"e5e494297834139046b9f5c8613f2cee2f4e02a5de1361964991428f3e00490f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    t = s.replace(' ', '').upper()\n    if t.startswith('GB'):\n        t = t[2:]\n    if len(t) != 9 or not t.isascii() or not t.isdigit():\n        return 'malformed'\n    total = sum(int(ch) * w for ch, w in zip(t[:7], range(8, 1, -1)))\n    c = int(t[8])\n    if (total + c) % 97 == 0:\n        return 'mod97'\n    if (total + c + 55) % 97 == 0:\n        return 'mod9755'\n    return 'invalid'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"GB041839277\"]', ['GB041839277'], 'mod97'], ['regression [\"729236520\"]', ['729236520'], 'mod97'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid'], ['control [\"260407727\"]', ['260407727'], 'invalid'], ['control [\"029331391\"]', ['029331391'], 'invalid']], [['regression [\"GB 029 3313 90\"]', ['GB 029 3313 90'], 'mod97'], ['regression [\"581077575\"]', ['581077575'], 'mod9755'], ['control [\"029331391\"]', ['029331391'], 'invalid'], ['control [\"581077576\"]', ['581077576'], 'invalid'], ['control [\"GB658372602\"]', ['GB658372602'], 'mod97'], ['control [\"GB98078068\"]', ['GB98078068'], 'malformed'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed'], ['control [\"123456789\"]', ['123456789'], 'invalid']], [['regression [\"331553089\"]', ['331553089'], 'mod97'], ['regression [\"GB784073455\"]', ['GB784073455'], 'mod9755'], ['control [\"123456789\"]', ['123456789'], 'invalid'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid'], ['control [\"260407727\"]', ['260407727'], 'invalid']], [['regression [\"155142529\"]', ['155142529'], 'mod9755'], ['regression [\"GB801525174\"]', ['GB801525174'], 'mod97'], ['control [\"260407727\"]', ['260407727'], 'invalid'], ['control [\"029331391\"]', ['029331391'], 'invalid'], ['control [\"581077576\"]', ['581077576'], 'invalid'], ['control [\"GB658372602\"]', ['GB658372602'], 'mod97'], ['control [\"GB98078068\"]', ['GB98078068'], 'malformed'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed']], [['regression [\"GB980780684\"]', ['GB980780684'], 'mod97'], ['regression [\"980 7806 84\"]', ['980 7806 84'], 'mod97'], ['control [\"GB98078068X\"]', ['GB98078068X'], 'malformed'], ['control [\"123456789\"]', ['123456789'], 'invalid'], ['control [\"041839278\"]', ['041839278'], 'invalid'], ['control [\"GB 261 7623 04\"]', ['GB 261 7623 04'], 'mod9755'], ['control [\"261762305\"]', ['261762305'], 'invalid'], ['control [\"729236521\"]', ['729236521'], 'invalid']]]\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-uk-vat-check-pair","generated_at":"2026-09-29T14:48:40.885085+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Invoice processing screens supplier VAT numbers before reclaiming input tax.","root_cause":"c is taken from the final digit only instead of the two-digit number formed by digits 8 and 9.","sha256":"fb18e0fac97d242659296f70d37c4026f9d726b63b0e721f737038c46eadcc06","title":"UK VAT reads only the last check digit · 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":38.774,"exit_code":1,"observations":[{"actual":"invalid","check":"regression [\"GB041839277\"]","expected":"mod97","passed":false},{"actual":"invalid","check":"regression [\"729236520\"]","expected":"mod97","passed":false},{"actual":"invalid","check":"control [\"041839278\"]","expected":"invalid","passed":true},{"actual":"mod9755","check":"control [\"GB 261 7623 04\"]","expected":"mod9755","passed":true},{"actual":"invalid","check":"control [\"261762305\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"729236521\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"260407727\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"029331391\"]","expected":"invalid","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"GB041839277\\\"]\", \"actual\": \"invalid\", \"expected\": \"mod97\", \"passed\": false}, {\"check\": \"regression [\\\"729236520\\\"]\", \"actual\": \"invalid\", \"expected\": \"mod97\", \"passed\": false}, {\"check\": \"control [\\\"041839278\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"GB 261 7623 04\\\"]\", \"actual\": \"mod9755\", \"expected\": \"mod9755\", \"passed\": true}, {\"check\": \"control [\\\"261762305\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"729236521\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"260407727\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"029331391\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":36.661,"exit_code":1,"observations":[{"actual":"invalid","check":"regression [\"GB041839277\"]","expected":"mod97","passed":false},{"actual":"invalid","check":"regression [\"729236520\"]","expected":"mod97","passed":false},{"actual":"invalid","check":"control [\"041839278\"]","expected":"invalid","passed":true},{"actual":"mod9755","check":"control [\"GB 261 7623 04\"]","expected":"mod9755","passed":true},{"actual":"invalid","check":"control [\"261762305\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"729236521\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"260407727\"]","expected":"invalid","passed":true},{"actual":"invalid","check":"control [\"029331391\"]","expected":"invalid","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"GB041839277\\\"]\", \"actual\": \"invalid\", \"expected\": \"mod97\", \"passed\": false}, {\"check\": \"regression [\\\"729236520\\\"]\", \"actual\": \"invalid\", \"expected\": \"mod97\", \"passed\": false}, {\"check\": \"control [\\\"041839278\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"GB 261 7623 04\\\"]\", \"actual\": \"mod9755\", \"expected\": \"mod9755\", \"passed\": true}, {\"check\": \"control [\\\"261762305\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"729236521\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"260407727\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"control [\\\"029331391\\\"]\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"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."}}