I came across this interesting infographic from byjess.net that explains the meaning behind credit card numbers and also how to validate them.
The validation method relies on the Luhn algorithm, also known as the “mod 10” algorithm. It’s a simple checksum formula than can be used to validate a variety of identification numbers, such as IMEI numbers, National Provider Identifier numbers in US and Canadian Social Insurance Numbers, and not just credit card numbers.
Instead of calculating it in your head you can try it here:
(Don’t worry, the form data is not sent anywhere. It simply triggers a call to the JavaScript function that checks the number.)

Well this is a really good post. Thanks