{"abstract":"Generated check characters fail validation.","category":"Check-digit algorithms","checks":8,"contract":"Luhn mod N check-character generation over the base-36 alphabet 0-9a-z (input is lower-cased; empty input or any other character returns None). From the rightmost payload character the factor alternates 2,1,2,...; each addend factor * codepoint is folded as addend // 36 + addend % 36; the check is the alphabet character at (36 - sum % 36) % 36.","evaluation_group":"w2-check_digit_algorithms-luhn-mod-n","failed_approach":"Choosing the start factor from the payload length parity only works for half of the lengths.","family":"w2-check_digit_algorithms-luhn-mod-n-factor-start","id":"FA-72711","implementations":{"attempt":{"sha256":"13443148cd54d76154d093045ec334b6c751c897d1cc4051b2a5da38afd82662","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    A = '0123456789abcdefghijklmnopqrstuvwxyz'\n    n = len(A)\n    t = s.lower()\n    if not t or any(ch not in A for ch in t):\n        return None\n    factor = 2 if len(t) % 2 else 1\n    total = 0\n    for ch in reversed(t):\n        addend = factor * A.index(ch)\n        factor = 1 if factor == 2 else 2\n        total += addend // n + addend % n\n    return A[(n - total % n) % n]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"lyx7g3y\"]', ['lyx7g3y'], 'x'], ['regression [\"1\"]', ['1'], 'y'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None]], [['regression [\"hn3a6aj\"]', ['hn3a6aj'], 'a'], ['regression [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1']], [['regression [\"iu2qty\"]', ['iu2qty'], 'k'], ['regression [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"um\"]', ['um'], 'x'], ['partial-repair [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6']], [['regression [\"bbw4ngt\"]', ['bbw4ngt'], 's'], ['regression [\"hgvs8gmf0\"]', ['hgvs8gmf0'], 'j'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None]], [['regression [\"um\"]', ['um'], 'x'], ['regression [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2']]]\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":"5e59c88255dc93942ac5d936cd9afb377a4e763bb6c9741112affef65e5fcd51","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    A = '0123456789abcdefghijklmnopqrstuvwxyz'\n    n = len(A)\n    t = s.lower()\n    if not t or any(ch not in A for ch in t):\n        return None\n    factor = 1\n    total = 0\n    for ch in reversed(t):\n        addend = factor * A.index(ch)\n        factor = 1 if factor == 2 else 2\n        total += addend // n + addend % n\n    return A[(n - total % n) % n]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"lyx7g3y\"]', ['lyx7g3y'], 'x'], ['regression [\"1\"]', ['1'], 'y'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None]], [['regression [\"hn3a6aj\"]', ['hn3a6aj'], 'a'], ['regression [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1']], [['regression [\"iu2qty\"]', ['iu2qty'], 'k'], ['regression [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"um\"]', ['um'], 'x'], ['partial-repair [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6']], [['regression [\"bbw4ngt\"]', ['bbw4ngt'], 's'], ['regression [\"hgvs8gmf0\"]', ['hgvs8gmf0'], 'j'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None]], [['regression [\"um\"]', ['um'], 'x'], ['regression [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2']]]\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":"108df848c30b6b43819a8ba4a6810f8780fdd5b9f824bc49cbd4900c43456098","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    A = '0123456789abcdefghijklmnopqrstuvwxyz'\n    n = len(A)\n    t = s.lower()\n    if not t or any(ch not in A for ch in t):\n        return None\n    factor = 2\n    total = 0\n    for ch in reversed(t):\n        addend = factor * A.index(ch)\n        factor = 1 if factor == 2 else 2\n        total += addend // n + addend % n\n    return A[(n - total % n) % n]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"lyx7g3y\"]', ['lyx7g3y'], 'x'], ['regression [\"1\"]', ['1'], 'y'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None]], [['regression [\"hn3a6aj\"]', ['hn3a6aj'], 'a'], ['regression [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1']], [['regression [\"iu2qty\"]', ['iu2qty'], 'k'], ['regression [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"um\"]', ['um'], 'x'], ['partial-repair [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6']], [['regression [\"bbw4ngt\"]', ['bbw4ngt'], 's'], ['regression [\"hgvs8gmf0\"]', ['hgvs8gmf0'], 'j'], ['partial-repair [\"s8zc\"]', ['s8zc'], '5'], ['partial-repair [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None]], [['regression [\"um\"]', ['um'], 'x'], ['regression [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['partial-repair [\"60an\"]', ['60an'], '9'], ['control [\"ZZZZZZ\"]', ['ZZZZZZ'], '6'], ['control [\"0rr\"]', ['0rr'], 'q'], ['control [\"z\"]', ['z'], '1'], ['control [\"zz\"]', ['zz'], '2']]]\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-mod-n-factor-start","generated_at":"2026-09-29T14:48:40.886715+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Voucher and licence-key systems protect alphanumeric codes with Luhn mod N check characters.","repair":"Start at factor 2 for the rightmost payload character.","root_cause":"Generation starts the factor at 1, the validation phase, although the check character is not yet present.","sha256":"ba96a34b910545dc055708bfd36e426e759d3d87b687bf24753f57a2d344b531","title":"Luhn mod N generation starts with factor one · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.097,"exit_code":1,"observations":[{"actual":"x","check":"regression [\"lyx7g3y\"]","expected":"x","passed":true},{"actual":"y","check":"regression [\"1\"]","expected":"y","passed":true},{"actual":"w","check":"partial-repair [\"s8zc\"]","expected":"5","passed":false},{"actual":"z","check":"partial-repair [\"i3wknpx64b\"]","expected":"a","passed":false},{"actual":"q","check":"control [\"0rr\"]","expected":"q","passed":true},{"actual":"1","check":"control [\"z\"]","expected":"1","passed":true},{"actual":"2","check":"control [\"zz\"]","expected":"2","passed":true},{"actual":null,"check":"control [\"abc-1\"]","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"lyx7g3y\\\"]\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"regression [\\\"1\\\"]\", \"actual\": \"y\", \"expected\": \"y\", \"passed\": true}, {\"check\": \"partial-repair [\\\"s8zc\\\"]\", \"actual\": \"w\", \"expected\": \"5\", \"passed\": false}, {\"check\": \"partial-repair [\\\"i3wknpx64b\\\"]\", \"actual\": \"z\", \"expected\": \"a\", \"passed\": false}, {\"check\": \"control [\\\"0rr\\\"]\", \"actual\": \"q\", \"expected\": \"q\", \"passed\": true}, {\"check\": \"control [\\\"z\\\"]\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"control [\\\"zz\\\"]\", \"actual\": \"2\", \"expected\": \"2\", \"passed\": true}, {\"check\": \"control [\\\"abc-1\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":36.62,"exit_code":1,"observations":[{"actual":"n","check":"regression [\"lyx7g3y\"]","expected":"x","passed":false},{"actual":"z","check":"regression [\"1\"]","expected":"y","passed":false},{"actual":"w","check":"partial-repair [\"s8zc\"]","expected":"5","passed":false},{"actual":"z","check":"partial-repair [\"i3wknpx64b\"]","expected":"a","passed":false},{"actual":"q","check":"control [\"0rr\"]","expected":"q","passed":true},{"actual":"1","check":"control [\"z\"]","expected":"1","passed":true},{"actual":"2","check":"control [\"zz\"]","expected":"2","passed":true},{"actual":null,"check":"control [\"abc-1\"]","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"lyx7g3y\\\"]\", \"actual\": \"n\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"regression [\\\"1\\\"]\", \"actual\": \"z\", \"expected\": \"y\", \"passed\": false}, {\"check\": \"partial-repair [\\\"s8zc\\\"]\", \"actual\": \"w\", \"expected\": \"5\", \"passed\": false}, {\"check\": \"partial-repair [\\\"i3wknpx64b\\\"]\", \"actual\": \"z\", \"expected\": \"a\", \"passed\": false}, {\"check\": \"control [\\\"0rr\\\"]\", \"actual\": \"q\", \"expected\": \"q\", \"passed\": true}, {\"check\": \"control [\\\"z\\\"]\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"control [\\\"zz\\\"]\", \"actual\": \"2\", \"expected\": \"2\", \"passed\": true}, {\"check\": \"control [\\\"abc-1\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":37.625,"exit_code":0,"observations":[{"actual":"x","check":"regression [\"lyx7g3y\"]","expected":"x","passed":true},{"actual":"y","check":"regression [\"1\"]","expected":"y","passed":true},{"actual":"5","check":"partial-repair [\"s8zc\"]","expected":"5","passed":true},{"actual":"a","check":"partial-repair [\"i3wknpx64b\"]","expected":"a","passed":true},{"actual":"q","check":"control [\"0rr\"]","expected":"q","passed":true},{"actual":"1","check":"control [\"z\"]","expected":"1","passed":true},{"actual":"2","check":"control [\"zz\"]","expected":"2","passed":true},{"actual":null,"check":"control [\"abc-1\"]","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"lyx7g3y\\\"]\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"regression [\\\"1\\\"]\", \"actual\": \"y\", \"expected\": \"y\", \"passed\": true}, {\"check\": \"partial-repair [\\\"s8zc\\\"]\", \"actual\": \"5\", \"expected\": \"5\", \"passed\": true}, {\"check\": \"partial-repair [\\\"i3wknpx64b\\\"]\", \"actual\": \"a\", \"expected\": \"a\", \"passed\": true}, {\"check\": \"control [\\\"0rr\\\"]\", \"actual\": \"q\", \"expected\": \"q\", \"passed\": true}, {\"check\": \"control [\\\"z\\\"]\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"control [\\\"zz\\\"]\", \"actual\": \"2\", \"expected\": \"2\", \"passed\": true}, {\"check\": \"control [\\\"abc-1\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}