Have you ever taken all of your credit cards, spread them out on a coffee table and noticed patterns in the 16 digit numbers? Well, neither have I. But believe it or not, there is a way to verify if the credit cards you hold in your wallet are the real deal or phony bologna.
Hans Peter Luhn patented an algorithm in 1954 which would forever be known as the Luhn algorithm. For those not familiar with the term, an algorithm is just a series of instructions used in mathematical applications to complete a task or problem. Anyway, the Luhn algorithm is particularly fun because every credit card and debit card number in the US follows this set of rules. The reason that every credit card Issuer uses this algorithm is not to prevent fraud or identity theft, but rather to identify accidental errors in manufacturing and distributing credit cards.
Using the credit card example below, let’s take a look at how the Luhn algorithm works.
Here we have a basic credit card with a 16 digit number (note that the last four digits, 9123, are a little difficult to see). In order to see if this card’s number is real, we need to follow a few easy steps. First we identify the check digit, which is always the last digit on the credit card. In this instance, the check digit is 3. Then we double every other number, starting first with the number to the left of the check digit, which in the example above is 2 . Our new credit card number is as follows:
(10)4(2)2 (14)5(6)4 (10)6(14)8 (18)1(4)3
Any double digit number needs to have it’s single digits added together to create it’s own single digit number. After completing this step we have a new number which reads:
1422 5564 1658 9143
If we add up all of these single digits, and the total is divisible by 10 (without a remainder) we have ourselves a valid credit card number. Unfortunately for all you fraudsters out there, the number we have adds up to 66, which is not divisible by 10, making the credit card above, a fake.