Determine the number of valid 6-digit integers (ie. no leading zeros) where no digits can be repeated and such that it is divisible by 4
My answer (correct):
Fact: integer is divisible by 4 if the last two digits are divisible by 4 (eg. 416, 756)
There are
$8\times7\times6\times5\times6$ valid 6-digit integers that end in $04, 08, 20, 40, 60, 80$
(ie. divisible by 4, contains one zero and no digit repeated)$7\times7\times6\times5\times16$ valid 6-digit integers that end in
$12, 16, 24, 28, 32, 36, 48, 52, 56, 64, 68, 72, 76, 84, 92, 96$
(ie. divisible by 4, does not contain any zeros and no digit repeated)
$\therefore$ There are $(8\times7\times6\times5\times6) + (7\times7\times6\times5\times16)$ valid 6-digit integers where no digits can be repeated and such that it is divisible by 4
My question:
Is there a better (as in less error-prone) way to solve the original problem by hand?
(enumerating the two-digit numbers that are divisible by 4 and adding the amount of such integers correctly was a bit problematic for me)
This might not be the answer you'd want to hear, but yes. It's simply counting. And computers are really, really good at this. As a mathematician in the modern world I think it's important to learn at least the basics of programming, as numerical exploration can often help you form quick hypotheses and intuitions, and use those to speed up finding references, proofs, or coming up with your own.
So in this example, we generate every valid 6-digit integer such that it is divisible by 4 and has no repeated digits. Then we simply display how many such integers we generated. For example in Python:
Which instantly gives our result 33600.