# Six digit permutations of 1 to 6 - divisible by 8

I am working on a problem in A Concise Introduction to Pure Mathematics 3rd Ed under the counting and choosing chapter. It is a multipart question and I am stuck on the last part:

'The digits 1 2 3 4 5 6 are written in some order to form a six digit number'.

...

d) How many are divisible by $8$? (Hint: first show that the remainder on dividing a six digit number $abcdef$ by 8 is $4d + 2e + f$)

I know there are 720 different permutations from a previous question, and I realised that only the last three digits affect divisibility by 8 as $8 * 125 = 1000$, so the final answer will be $3!x$ where $x$ is the number of permutations of the last three digits that are divisible by 8.

In terms of the hint it was simple to use long division to establish $\frac{100d + 10e + f}{8} = 12d + e$ with a remainder $4d + 2e + f$. For this remainder to be divisible by 8, I can see that $f$ must also be even. I just can't make the last step, can anyone please give me a hint (would prefer not to be given the actual answer if possible!).

-
I wuld break the problem into two case: consider $e$ even and $e$ odd, and analyse these cases separately. The case $e$ is even is quite restrictive. –  Geoff Robinson May 29 at 12:10
I would say $100d + 10e + f = 8(12d + e) + 4d + 2e + f$, so $100d + 10e + f \equiv 4d + 2e + f \mod 8$. –  NovaDenizen May 29 at 13:10
Since this is the fourth in a multi-part question, can you use the other answers to solve this one? –  NovaDenizen May 29 at 13:19