[Math] How many five digit numbers are divisible by three and also contain 6 as one of its digit

combinatorics

How many five digit numbers are divisible by three and also contain $6$ as one of its digit?

My attempt
We have to find out four digit "word"( a four digit number that can start with 0 ) divisible by three. If word start with 0 we put 6 on the left of it , and if word start with non zero digit then we can place 6 in $(4-1)+2 = 5 $ places.
But with this method there is a case explosion. Is there a short clever method?

Best Answer

Let $s$ be the number of $5$-digit numbers that are multiples of $3$.

Let $m$ be the number of $5$-digit numbers that are multiples of $3$ and don't contain $6$.

Finding $s$ is easy, it is $90000/3=30000$

Finding $m$ is also easy, there are exactly three multiples of $3$ that don't contain $6$ for every possible "start" (because each residue appears three times among the digits different from $6$) . So if $ \overline{abcd}$ is a four digit number there are $3$ digits $x$ so that $\overline{abcdx}$ is a multiple of $3$ not containing $6$. so $m=(8\times9\times9\times9)\times 3=17496$

Hence the answer is $30000-17496=12504$

Related Question