# Number of possible eight digit number divisible by 9

An eight digit number divisible by 9 is o be formed by using 8 digits out of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 without repetition. Find the number of ways in which it can be done.

I know divisible rule of 9 is sum of all the digits should be multiple of nine. But don't know how to use it in permutation.

• As $\sum_{r=0}^9r=45,$ we can only leave out $a,b$ in the eight digit number such that $9|(a+b)$ or $a+b=9$ – lab bhattacharjee Oct 3 '14 at 6:23

As pointed out in the post, all that matters is the digit sum. The sum of all your digits is divisible by $9$. So our number is divisible by $9$ if and only if the two digits not chosen are $0,9$ or $1,8$, or $2,7$, or $3,6$, or $4,5$.

If the two digits not chosen are $0,9$, there are $8!$ possible numbers.

If the two digits not chosen are any of the $4$ other pairs, then $0$ was chosen. Then there are in each case $7\cdot7!$ numbers. For $0$ cannot be the first digit of an $8$-digit number.

This gives a total of $8!+(4)(7)(7!)$.

• and so i am getting answer as 36(7!), Thanks. – Freddy Oct 3 '14 at 6:34
• You are welcome. Yes, your expression is right, and then we can multiply out. I kind of prefer to leave an answer whose shape reminds us of the structure of the argument. – André Nicolas Oct 3 '14 at 6:37

The sum of all the numbers between $0$ and $9$ is $45$, hence a multiple of $9$. This means that if you want the sum of $8$ numbers taken in this list to be a multiple of $9$, the sum of the two remaining numbers will also be a multiple of $9$. The only possible couples are $(0,9),(1,8),(2,7),(3,6),(4,5)$. When you select a given couple, you have then $8! = 40320$ possibilities to form your number with your $8$ digits.

Since you have $5$ different couples, the answer is $5*8! = 201600$.

If you forbid leading $0$, the number of possibilities become $7*7! = 35280$ for the last 4 couples. The answer then becomes $4*7*7+8! = 181440$.

• It should be 4*7*7! + 8!, isn't it? – Freddy Oct 3 '14 at 6:37
• Yes, I edited it straight away when I realised my mistake x) – Traklon Oct 3 '14 at 6:38
• but it's still 4∗7∗7. 😊 – Freddy Oct 3 '14 at 6:40