Number Theory – How Many Numbers of Form n = aaaaaaaaabcd are Divisible by 45

combinatoricselementary-number-theory

Let $n = aaaaaaaaabcd$ be a $12$-digited number divisible by $45$ where the digits a, b, c, d are not necessarily distinct and $a \neq 0 $. How many such numbers are there .

My approach
Since $a \in$ {1,2,3,4,5,6,7,8,9} so $a$ has $9$ choices.
$b,c \in$ {0,1,2,3,4,5,6,7,8,9} so $b,c$ has $10$ choices each.
$d \in $ {0,5} therfore $c$ has only 2 choices

Therefore total number of $12$ digited number of form $aaaaaaaaabcd$ which are divisible by $12$ is $2*10*10*9 = 1800$
This answer is wrong
How can I solve this

Best Answer

$b,c\in\{0,1,2,3,4,5,6,7,8,9\}$ so $b,c$ has $10$ choices each

This is where you went wrong. Consider a divisibility test for an integer by $9$, which is that the sum of its digits must itself be a multiple of $9$. Clearly it doesn't matter what $a$ is; there are $9$ of them in our template, and something added to itself $9$ times is always going to result in a multiple of $9$. This means that it's down to $b.c.d$ whether or not the final number is divisible by $9$; i.e. we need $b+c+d=9k$ for some integer $k$.

Now I want you to think of divisibility by $5$. What characteristic do all numbers divisible by $5$ share? If you thought "well, they all end in $0$ and $5$", great! That's the correct answer. And clearly you know it already, given that you've identified that $d\in\{0,5\}$. But ask yourself this: if $b+c+d$ is a multiple of $9$ — and $d=0$, say — what does that mean for $b$ and $c$? Well, it means that the sum of $b$ and $c$ itself has to be a multiple of $9$, doesn't it? So your sub-question now is, how many pairs can you make from $\{0,1,2,3,4,5,6,7,8,9\}$ such that their sum is a multiple of $9$? I can think of two right off the top of my head: $b=9,c=9$ and $b=0,c=9$. Of course, since addition is commutative, we can always swap $b$ and $c$ to get a new number that's still divisible by $45$ (that is, unless $b=c$)

And that's it, really. The case for $d=5$ is not much different, except you'll require that the sum of $b$ and $c$ be exactly $5$ less than a multiple of $9$. Otherwise, same rules. Now it's just a matter of counting pairs satisfying that very simple criterion and some multiplication to get the final answer. Have fun!