[Math] Number of possible eight digit number divisible by 9

permutationsself-learning

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.

Best Answer

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