News

All mainstream credit card numbers obey a mathematical trick designed to catch the most common typos. It’s called the Luhn ...
Rather than being specifically chosen by the credit card company, the check digit is automatically determined by the Luhn algorithm based on the preceding numbers in the sequence.
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.