Credit Cards and the Luhn Algorithm – how to pass the time when you’re bored

If you’re vaguely geeky then you probably know that there’s some mathematical formula behind the ISBN number on the barcode of a book so that typing errors can be spotted. The same applies to the embossed number across the middle of your credit or debit card.

So, if you’re stuck for something to occupy yourself with for a few minutes, see if the number on a card from your wallet or purse follows the rules. Take the following account number, for example. It’s only valid in test systems so can’t be used for fraudulent purposes (or no more than any other invented number can be).


The Luhn Algorithm, created around 60 years ago by Peter Luhn, is used to generate a checksum value for the account number using some basic maths.

The last digit is the checksum – in this case 7. We win a prize if we end up with this number after doing the maths.

Step 1

Start from the right and double every second digit. So the 2 becomes 4, the 1 becomes 2, and so on.


If you have a double-digit result, add those digits together. So the 16 becomes 7 and the 10 becomes 1.


Step 2

Add all the digits together (except the checksum number).

1+4+2+3+6+3+0+0+7+9+2+0+2+0+4 = 43

Step 3

Multiply that total by 9. The last digit of this new number should be the same as the checksum.

43 x 9 = 387 and the last digit is 7. Success! Cake all round.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s