Find number of six digit numbers divisible by $3$ but none of the digits is $3$
My try:
Let the six digits are $a,b,c,d,e,f$ such that
$$a+b+c+d+e+f=3p$$
where $1 \le p \le 18$
Now since $a \ge 1$ we have by Stars and Bars Technique number of solutions of the above equation as:
$$S=\sum_{p=1}^{18}\binom{3p+4}{5}$$
But if we use Exclusion method, its very lengthy.
Any hint?
Excluding $3$, there are exactly three digits congruent to each of $0,1$ and $2$ $\pmod 3$.
Let the first $5$ digits be whatever you like (excluding $3$) There are $8\times 9^4$ such numbers (trusting that the string can not start with $0$). Now we choose the final digit in order to make the sum of the digits $0\pmod 3$. For each given prefix, there are exactly $3$ ways to do that. Thus the answer is $$3\times 8\times 9^4$$