We all use credit and debit cards for POS purchase and internet transactions. These transactions are carried out with the serial number printed on the card and the PIN number. The card number is unique for all cards and reveals some information about the card and associated account.

Don't think that these card numbers are generated randomly. This number is not generated at random neither they are serially incriminated and allotted to new cards. There is an interesting maths behind them.

All types of debit/credit cards have certain amount of internal structure and they posses a numbering scheme. So by doing some simple arithmetic you can test for a valid card number. This test is based on Luhn Algorithm. This test is performed while doing any transaction. If the number satisfies the Luhn check, transaction is proceeded, else it is immediately terminated without any verification.

Suppose we have a VISA debit card having its card number as 4213-6630-0801-5882. We will check whether it is a valid card number or not, based on Luhn Algorithm.

Step 1: Note down all digits of card number.
Step 2: Multiply alternate digits by 2 starting from 2nd right most digit.
Step 3: Add digits of each cell.
Step 4: Added result.
Step 5: Add digits of all cells.

Step 1 4213 6630 0801 5882
Step 2 4x221x236x263x200x280x215x288x22
Step 3 82231+266008011+081+62
Step 4 8223366008011872
Step 5 8 + 2 + 2 + 3 + 3 + 6 + 6 + 0 + 0 + 8 + 0 + 1 + 1 + 8 + 7 + 2= 57

Total Sum = 57.
Since this number (57) is not perfectly divisible by 10, the card number is definitely invalid. The test shows that it is not in accordance with the Luhn Algorithm. However if such a card number is ever generated, the value of the last check digit would be adjusted so that Luhn condition is satisfied. In this case if last digit would be 5, then the card may be possibly valid. Placing 5 as the last check digit will make this sum =60, which is fully divisible by 10.

On the opposite, if the Sum Mod 10 evaluates to 0, the card may be a valid one.

Check this for your card, see if it comes true?

Before this we have illustrated how to check if an IMEI number is valid or not?

Post tagged in: Amazing Facts