How many three-digit positive integers have three different digits and at least one prime digit?
How many three-digit positive integers have at least one prime digit?
I thought about listing them all out but that would take forever.
Answer: 548 for the first one, 720 for the second one.
Case 1: The first digit is a prime number; none of the rest are.
4 (there are four primes 1-9) x 6 (6 non-primes) x 5 (5 non-prime and non-whatever-the-second-digit-was numbers) = 120
Case 2: The second digit is a prime number; none of the rest are.
5 x 4 x 5 = 100
Case 3: The third digit is a prime number; none of the rest are.
5 x 5 x 4 = 100
Case 4: The first two are prime; the third isn't.
4 x 3 x 6 = 72
Case 5: The last two are prime; the first isn't.
5 x 4 x 3 = 60
Case 6: The middle digit isn't prime; the rest are.
4 x 6 x 3 = 72
Case 7: All three digits are prime.
4 x 3 x 2 = 24
Adding these all up gives a sum of 548.
Tweaking the formulas used a little bit to answer the second question gives an answer of 720.
There's probably a more efficient way than this, but it does beat listing them out (if it is right, that is).