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

permutations

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.

Best Answer

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