algorithm · 2025-03-10 · 5 min read
The transposition Luhn cannot catch — and the algorithms that can
Luhn detects every single-digit error and most adjacent swaps — except one specific pair, plus a family of twin errors. Here is the math and the stronger alternatives.

Swapping two adjacent digits changes which one gets doubled in the Luhn procedure. For almost all pairs this changes the sum and the error is caught. There is exactly one exception among adjacent pairs — and you can reproduce it with the 'swap two adjacent digits' button in the Luhn lab.
The 09 ↔ 90 blind spot
Doubling 9 gives 18 → 1 + 8 = 9. Doubling 0 gives 0. So the pair contributes 9 + 0 = 9 whether it reads 09 or 90, and the total is unchanged. Every other adjacent transposition (e.g. 12 ↔ 21) alters the sum by a non-multiple of 10 and is detected.
Twin errors
Luhn also misses some twin substitutions in the doubled position: 22 ↔ 55, 33 ↔ 66 and 44 ↔ 77, because 2·2 = 4 and 2·5 = 10 → 1 both end up contributing values that differ by a multiple of 10 once the neighbouring digit is included. These are rarer in practice than single-digit slips, which is why Luhn's coverage was considered good enough for keypunch operators in the 1950s — see a short history of Luhn.
Stronger schemes
- The Verhoeff algorithm (1969) uses the dihedral group D5 and catches all single-digit errors and all adjacent transpositions.
- The Damm algorithm (2004) achieves the same with a simpler quasigroup table and no special-casing.
- ISO 7064 defines several mod-11 and mod-97 variants used in IBANs and ISBNs.
Payment networks never switched because the installed base is enormous, Luhn is good enough for its narrow purpose, and the real security lives in authorization — not in the check digit.

Keywords: Luhn limitations, transposition error, Verhoeff algorithm, Damm algorithm, check digit comparison, 09 90 swap
Frequently asked questions
Which error does Luhn fail to detect?
Swapping adjacent 0 and 9 (09 ↔ 90), and some twin substitutions such as 22 ↔ 55 in the doubled position.
Is there a better check digit than Luhn?
Yes — Verhoeff and Damm detect all single-digit errors and all adjacent transpositions, but card networks keep Luhn for compatibility.