There are two factors to consider when deciding how to handle the problem of a work sample: sample size and population characteristics. Sample size is determined by a formula based on the power of the sample or its ability to represent the population with a predictable margin of error.
The resulting complexity makes card type detection code difficult to write, read, and maintain. As an example of this complexity, consider this JavaScript regular expression used to detect Discover card numbers starting with 6011, 622126-622925, 644-649, and 65:
American Express is the most commonly held credit card that doesn't have a 16-digit number on the front. American Express card numbers have only 15 digits. Cards issued by Diners Club International also do not have 16 numbers. Diners Club cards are issued with 14 numbers on the front. However, some Diners Club cards issued in the U.S. that bear the MasterCard symbol now have 16 digits.