How many positive integers less than 1000 are there which contain at least one 4 or at least one 9 (or both)?

Obviously theres 100 in 400's and 900's but short of counting every other number whats the quickest way to work this out?

  • $\begingroup$ Although Henning's approach is the cleanest, your approach could also be continued. There are 100 numbers with a 4 in the first position, and just as many with a 4 in the second or third positions. After subtracting the double counting solutions (two times 4/9) and again adding the triple counted solutions (all 4/9) by the inclusion-exclusion principle you should arrive at the same answer. $\endgroup$ – TMM Apr 23 '17 at 13:33

There are $8^3-1$ numbers that contain neither $4$ nor $9$. (The $-1$ is because $000$ doesn't count).

Subtract that from the total number of integers less than $1000$.

Of course, since $0$ doesn't have a $4$ or $9$ anyway, you could equally well ask about non-negative integers less than $1000$, in which case you'd just subtract $8^3$ from $10^3$, getting the same result.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.