Luhn Check
It is possible to tell if a number could be a valid credit card. Credit cards numbers can be validated against an algorithm known as a Luhn. Read this first.
http://www.datagenetics.com/blog/july42013/index.html
Counting from the check digit, which is the rightmost, and moving left, double the value of every second digit.
Sum the digits of the products together with the undoubled digits from the original number.
If the total ends in 0 (put another way, if the total modulo 10 is congruent to 0), then the number is valid according to the Luhn formula; else it is not valid.
Image from http://www.impuls-imaging.com/wp-content/uploads/2013/07/luhn_algorithm.png
Mod 10+5 Variant Some credit cards use the “Mod 10 plus 5” variant to extend the space of valid card numbers.[citation needed] In this variant, if the sum ends in 0 or 5, the number is considered valid.
from http://www.moneybluebook.com/imagesvr_ce/mbb/luhn-amex-calculation.jpg
A more extensive analysis with good images and an online Luhn Checker (currently blocked by Harrison network filter)
Pingback: Mini Open Ended Project - Mr. M online