# Using digits $0,1,2,3,4$ and $5$ only once, how many $5$ digit numbers can be formed which are divisible by $4$?

Using digits $0,1,2,3,4$ and $5$ only once, how many $5$ digit numbers can be formed which are divisible by $4$?

I worked on this problem and I have the solution as:

The number of 5 digit numbers formed will be $5 \cdot 5 \cdot 4 \cdot 3 \cdot 2$, which comes to $600$. Now, to get the numbers divisible by $4$, what I did was $600/4$, which comes out to be $150$, but the answer to this problem is $144$.

Please tell me where I went wrong, and if there is a better approach, please provide details about it.

• Hint: A number is divisible by $4$ if and only if its last two digits as a 2-digit number is divisible by $4$. – Guy May 20 '17 at 9:16
• If you use $0,\ldots,5$ once only, you'll end up with a $6$-digit number. – Lord Shark the Unknown May 20 '17 at 9:17
• Please read this tutorial on how to typeset mathematics on this site. – N. F. Taussig May 21 '17 at 12:04

Here's a very basic approach.

The last two digits must be one of $\{04, 12, 20, 24, 32, 40, 52\}$.

There are two cases to examine, those with a $0$ ($\{04, 20, 40\}$) and those without ($\{12, 24, 32, 52\}$).

The first batch create $4!=24$ variants each, to $3\times24=72$ in total.

The second batch have a forbidden digit in $0$, which can't appear first, so $\frac34\times4!=18$, for a total of $4\times18=72$.

Total: $144$.

We can think to this "scheme": you have five ordered empty "boxes" and each of them has to be filled with one digit from $0,\ldots,5$ (which are $6$ "objects") with no repetitions, in order to get a $5$-digits number. This means that the last two digits must form a number which is divisible by $4$; then the possible last two digits are as follows: $04$, $12$, $20$, $24$, $32$, $40$, $52$. Now, take for instance $04$; how many numbers (strings) of five distinct digits ending with $04$ are there? Since the last two digits are taken, we have to choose the first three among the remaining ones, that is we have to choose and order $3$ objects out of the $4$ left: this means we have $D_{4,3} = 4 \cdot 3 \cdot 2$ such strings. The same reasoning applies to $20$ and $40$, but not to $12$, $24$, $32$ and $52$: in these cases, in facts, for the remaining three digits $0$ is available but cannot be chosen as first digit, since we want $5$-digits numbers. Thus, in these four cases, the first digit can be filled in $3$ ways (and not $4$, because $0$ is also excluded), the second in $3$ ways and the third in $2$, giving $3\cdot 3\cdot 2$ possible numbers for each couple of final two non-zero digits. Hence, since for $04$, $20$ and $40$ (which are $3$ "cases") we apply the first reasoning, and for $12$, $24$, $32$ and $52$ ($4$ "cases") the second one, the total amount of numbers of five distinct digits (chosen among $0,\ldots,5$) that are divisible by $4$ is $$3 \cdot (4 \cdot 3 \cdot 2) + 4 \cdot (3 \cdot 3 \cdot 2) = 144.$$