Number of six digit numbers divisible by $3$ but none of the digits is $3$

965 Views Asked by At

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?

2

There are 2 best solutions below

5
On BEST ANSWER

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$$

0
On

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$...