Subtraction principle
By Emily Wilson •
How many positive integers less than 10000 are there which contain a digit 2 or 3?
Is this the right derivation? $$9\times9\times9\times8=5832$$ $$5832-2=5830$$ $$9998-5830=4168$$
$\endgroup$ 52 Answers
$\begingroup$Count the complement set: the number of numbers from 0000 to 9999 with no 2 or 3. For each of the four places (units, tens, hundreds, thousands) there are 8 possibilities for this, so the complement number is $8^4=4096$. Subtract this from 10000 to get the answer: $10000-4096=5904$.
$\endgroup$ 1 $\begingroup$Count the number of naturals with at least one 2, then count the number with at least one 3 and subtract the number with boh 2 and 3
$\endgroup$