{"abstract":"Codes containing letters in doubled positions receive the wrong check character.","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.","contract_signature":"s","evaluation_group":"w2-check_digit_algorithms-luhn-mod-n","failed_approach":"Keeping only addend % 36 drops the carry of doubled codepoints 18 and above.","family":"w2-check_digit_algorithms-luhn-mod-n-base-n-digit-sum","id":"FA-72706","implementations":{"attempt":{"sha256":"7747ed393335e843b42cc56fffa42ff9c432f45e8d2e402c1bb4732f2638345d","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\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 [\"g22\"]', ['g22'], 'y'], ['partial-repair [\"hn3a6aj\"]', ['hn3a6aj'], 'a'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['regression [\"iu2qty\"]', ['iu2qty'], 'k'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"60an\"]', ['60an'], '9'], ['regression [\"bbw4ngt\"]', ['bbw4ngt'], 's'], ['partial-repair [\"hgvs8gmf0\"]', ['hgvs8gmf0'], 'j'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"nx\"]', ['nx'], 'i'], ['regression [\"um\"]', ['um'], 'x'], ['partial-repair [\"0rr\"]', ['0rr'], 'q'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['regression [\"w\"]', ['w'], '7'], ['partial-repair [\"yl5unzgy\"]', ['yl5unzgy'], '2'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']]]\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":"bf795f1a246d004c0831192bd376ec098c5433afa3e99a25c7e71a8f2d8d0936","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 // 10 + addend % 10\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 [\"g22\"]', ['g22'], 'y'], ['partial-repair [\"hn3a6aj\"]', ['hn3a6aj'], 'a'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"i3wknpx64b\"]', ['i3wknpx64b'], 'a'], ['regression [\"iu2qty\"]', ['iu2qty'], 'k'], ['partial-repair [\"a5qsqld2\"]', ['a5qsqld2'], 'r'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"60an\"]', ['60an'], '9'], ['regression [\"bbw4ngt\"]', ['bbw4ngt'], 's'], ['partial-repair [\"hgvs8gmf0\"]', ['hgvs8gmf0'], 'j'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"nx\"]', ['nx'], 'i'], ['regression [\"um\"]', ['um'], 'x'], ['partial-repair [\"0rr\"]', ['0rr'], 'q'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']], [['regression [\"w35lg7vo1l\"]', ['w35lg7vo1l'], 'c'], ['regression [\"w\"]', ['w'], '7'], ['partial-repair [\"yl5unzgy\"]', ['yl5unzgy'], '2'], ['control [\"1\"]', ['1'], 'y'], ['control [\"s8zc\"]', ['s8zc'], '5'], ['control [\"abc-1\"]', ['abc-1'], None], ['control [\"\"]', [''], None], ['control [\"0\"]', ['0'], '0']]]\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-base-n-digit-sum","generated_at":"2026-09-29T14:48:40.886675+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.","root_cause":"The addend is folded as addend // 10 + addend % 10, the decimal Luhn rule, instead of in base 36.","sha256":"e63767efff40e983c4576a533bd588574e17a883852f450acdd07b9427af4a05","title":"Luhn mod N folds addends in base ten · 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.807,"exit_code":1,"observations":[{"actual":"0","check":"regression [\"lyx7g3y\"]","expected":"x","passed":false},{"actual":"y","check":"regression [\"g22\"]","expected":"y","passed":true},{"actual":"b","check":"partial-repair [\"hn3a6aj\"]","expected":"a","passed":false},{"actual":"y","check":"control [\"1\"]","expected":"y","passed":true},{"actual":"5","check":"control [\"s8zc\"]","expected":"5","passed":true},{"actual":null,"check":"control [\"abc-1\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"\"]","expected":null,"passed":true},{"actual":"0","check":"control [\"0\"]","expected":"0","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"lyx7g3y\\\"]\", \"actual\": \"0\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"regression [\\\"g22\\\"]\", \"actual\": \"y\", \"expected\": \"y\", \"passed\": true}, {\"check\": \"partial-repair [\\\"hn3a6aj\\\"]\", \"actual\": \"b\", \"expected\": \"a\", \"passed\": false}, {\"check\": \"control [\\\"1\\\"]\", \"actual\": \"y\", \"expected\": \"y\", \"passed\": true}, {\"check\": \"control [\\\"s8zc\\\"]\", \"actual\": \"5\", \"expected\": \"5\", \"passed\": true}, {\"check\": \"control [\\\"abc-1\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"0\\\"]\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.581,"exit_code":1,"observations":[{"actual":"i","check":"regression [\"lyx7g3y\"]","expected":"x","passed":false},{"actual":"p","check":"regression [\"g22\"]","expected":"y","passed":false},{"actual":"2","check":"partial-repair [\"hn3a6aj\"]","expected":"a","passed":false},{"actual":"y","check":"control [\"1\"]","expected":"y","passed":true},{"actual":"5","check":"control [\"s8zc\"]","expected":"5","passed":true},{"actual":null,"check":"control [\"abc-1\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"\"]","expected":null,"passed":true},{"actual":"0","check":"control [\"0\"]","expected":"0","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"lyx7g3y\\\"]\", \"actual\": \"i\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"regression [\\\"g22\\\"]\", \"actual\": \"p\", \"expected\": \"y\", \"passed\": false}, {\"check\": \"partial-repair [\\\"hn3a6aj\\\"]\", \"actual\": \"2\", \"expected\": \"a\", \"passed\": false}, {\"check\": \"control [\\\"1\\\"]\", \"actual\": \"y\", \"expected\": \"y\", \"passed\": true}, {\"check\": \"control [\\\"s8zc\\\"]\", \"actual\": \"5\", \"expected\": \"5\", \"passed\": true}, {\"check\": \"control [\\\"abc-1\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"0\\\"]\", \"actual\": \"0\", \"expected\": \"0\", \"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."}}