News

All mainstream credit card numbers obey a mathematical trick designed to catch the most common typos. It’s called the Luhn ...
The Luhn algorithm uses modulo-10 mathematics. To calculate the check digit, multiply every even-position digit (when counted from the right) in the number by two.
Even if the algorithm works perfectly, it might still fluke out and get the answer wrong – consider, for example, the barcode check digit algorithm: you’re working modulo 10, so there’s a ...
If they don’t, the number is invalid. That’s why the last digit in the string is called the “check digit,” which completes the algorithm so it is divisible by 10.