How many numbers between $0$ and $9999$ have either of the digits $2,5,8$ at least once - Check my answer I'm preparing for an exam in combinatorics, and these type of question can certainly be in the exam.
I managed to solve it, but I'm unsure, and also would love to hear if there is a better way to do it (since I can't use a calculator in the exam, and this is quite calculation heavy)
What I did
numbers containing only $0,1,3,4,6,7,9$ are invalid. Let's count all the invalid ones:
Invalid numbers with 4 digits: We have $6$ options for the leftmost digit (not zero, two, five or eight), and $7$ options for the rest (because zero is allowed there) so thats $6*7*7*7=2058$
Invalid numbers with 3 digits: $6$ options for first digit, $7$ for the rest, that's $6*7*7=294$
Invalid numbers with 2 digits: $6$ for the first one, $7$ for the second one, thats $6*7=42$
Invalid numbers with a single digit: $7$ options ($0,1,3,4,6,7,9$)
Altogether: $2058+294+42+7=2401$
We have overall $2401$ invalid numbers, so $10000-2401=7599$ are valid.
 A: Your answer is correct, but there is a more straightforward method you could use. 
Just like you did first, let's consider the number of invalid numbers. So what we want to do is figure out how many numbers can be made using only the $7$ invalid digits. Imagine 4 slots, in which any of the $7$ digits can go. In the first slot, there can be 7 differents digits, in the second slot there can be also 7 different digits, and so on. We thus have $7\cdot 7 \cdot 7 \cdot 7$ different numbers consisting of invalid digits.
Your answer is $10000 - 7^{4}$ .
A: Your solution looks just fine!  I'd like to point out, though, that you could've made your life a little easier: instead of considering, say, 3-digit numbers with restrictions ($\neq 0$) on the first digit, you could have considered them as four digit numbers where the first digit is $0$.  Similarly, 2-digit numbers can be thought of as four-digit numbers in which the first two digits are $0$.  Etc.
In this way, you could just consider all $4$-long strings consisting only of the digits $\{0,1,3,4,6,7,9\}$, and still count the same thing!  There are of course $7^4=2401$ such strings; this leads back to your original solution.
A: Yes, your reasoning is perfectly correct. I like to check computational stuff like this with a quickly-written script. 
You can verify your result with this python script, if you want:
>>> counter = 0
>>> for i in range(0,10000):
...     j = str(i)
...     if (('2' in j) or ('5' in j) or ('8' in j)):
...             counter+=1
... 
>>> counter
7599

