The Maths Behind Everyday Life
The story, the formula and a worked example — see exactly where this maths shows up in the world around you.
The algorithm that validates every credit card number
A quick doubling-and-summing trick spots a mistyped card number instantly.
Before a payment even reaches the bank, the Luhn algorithm checks the card number for typos. Double every second digit, add everything up, and a valid number is always a multiple of 10.
Double, sum, check divisibility
Double every second digit from the right (subtract 9 if over 9), add all digits, and the total must be divisible by 10.
Valid Luhn number
Testing a number
Suppose the Luhn sum comes to 70.
Is it valid?
- 1
Take the total mod 10
- 2
Verdict
Divisible by 10, so it passes the Luhn check — a single typo would have made it non-zero.
A valid card number's Luhn sum ends in 0; typos almost always fail.
The formula behind it
Luhn Check
The takeaway
The Luhn checksum catches most mistyped card numbers instantly by requiring the doubled-and-summed digits to be divisible by 10.