What is the number of $5$ digit numbers divisible by $3$ that do not contain the digit $3$? What I tried was using modular arithmetic but the answer doesn't match, I know the answer is $17496$. So how to solve it ? 
Any help is appreciated. 
 A: The first digit is not zero, so there are $8\times 9^4$ five digit numbers which don't contain the digit $3$.
The first four digits can be freely chosen, and there are three available digits in each residue class mod $3$ ie $\{0,6,9\}\{1,4,7\}\{2,5,8\}$ so there will always be three possibilities for the final (units) digit.
I am sure you can complete the calculation from there. You are lucky they pulled out $3$ which makes all the residue classes the same size and simplifies the calculation.
A: Note that the first five digit number divisible by $3$ is $10,002$ and the last is $99,999$. Hence, there are: $$E = \frac {99,999-10,002}{3}+1$$ $$= 30,000$$ five digit numbers divisible by $3$.
Such a number can start with the eight digits: $(1,2,4,\ldots ,8,9) $ and then can have any one of the nine digits : $(0,1,2,4,\ldots,8,9)$ at the second, thirst and fourth positions. But, for the fifth position we must be careful, since the sum of the digits should be divisible by $3$.
Depending on the first four digits , we can choose either one of: $0,6,9$ or $1,4,7$ or $2,5,8$; either way, we have three choices. 
Hence, the number of ways we can form a five digit number divisible by $3$ without contains the digit $3$ equals: $$8\times 9^3 \times 3 =17496$$ as you have conjectured. 
