<s>[INST] Number of six digit numbers divisible by $3$ but none of the digits is $3$ 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?
 [/INST] The digits we can use to form these numbers are $$\{0, 1,2,4,5,6,7,8,9\}\equiv \{0, 1, 2,1, 2,0,1,2,0\}\pmod3$$
Let $S$ be the sum of the last five digits,
$$
\begin{array}{c|lcr}
S\bmod3 & \color{blue}0 & \color{red}1 & \color{green}2 \\
\text{Probability} & 1/3 & 1/3 & 1/3 \\
\end{array}
$$
Observe that the first digit $\in\{1,2,4,5,6,7,8,9\}\equiv\{\color{green}1,\color{red}2,\color{green}1,\color{red}2,\color{blue}0,\color{green}1,\color{red}2,\color{blue}0\}\bmod3$.
Therefore, the probability, that a six digit number - from the ones we are considering -  is divisible by $3$ is $$P=\color{blue}{\frac13\cdot\frac28}+\color{red}{\frac13\cdot\frac38}+\color{green}{\frac13\cdot\frac38}=\frac{8}{24}=\frac13$$ Therefore, exactly one third of all numbers - from the ones we are considering - is divisible by $3$...
</s>