Well, I have been using credit cards for about 3 years now. Long before when I was doing my E-commerce certification in SSI, Chennai(1999), one of our tutors taught us the art of finding out if a credit card number is valid or not. I was wanting to re-collect the learning and finally ended up googling as usual :-)
Just follow the below steps to validate if a card number is genuine or cooked up. Before we start there are some basic hygiene checks one has to do;
MASTERCARD Prefix- 51-55 Length -16
VISA Prefix- 4 Length -13,16
AMEX Prefix- 34 & 37 Length -15
If your card# is say 4216270001012807 then here it is how you validate;
Step 1- Multiply all the odd numbers starting from the first digit by 2. We get 82400040 as the digits. Adding them we get 8+2+4+0+0+0+4+0 = 18. In case on multiplying by 2 the number exceeds 9 say 12 then the resultant number must be put as 1+2=3
Step 2- Now, add all the even numbers in the card. 2+6+7+0+1+1+8+7 = 32
Step 3- Let's now add 18+32 = 50
Step 4 - Now on dividing 50/10 the remainder is zero. So, the card number is valid.
If the resultant number is not divisible by 10 then it's a fraudulent number!
Simple is'nt it? The name of this Algorithm is Mod 10(i.e.Modulus of 10)