<s>[INST] Divisibility by $12$ of $\overline{abcdef}$ How can one find all six digits numbers formed only with even number that are divisible by $12$?
My attempt was to find all six digits numbers $\overline{abcdef}$ with all digits from $\{0,2,4,6,8\}$ that are divisible with $3$ or $4$. For doing this I used inclusion-exclusion principle. How can I continue?
 [/INST] A trick is to reduce the restriction "must be divisible by $12$" to a restriction on as few digits as possible and let the other digits "run free".
Must be divisible by $12$ means must be divisible by $3$ and $4$.
Being divisible by $3$ means $a+b+c+d+e+f \equiv 0 \pmod 3$.  And that means we can take any one of the digits, say $f$, and note $f \equiv-(a+b+c+d+e)\pmod 3$.  So $a,b,c,d,e$ can "run free" and we have reduced the restriction "is divisible by $3$" to a restriction on only one digit.
Being divisible by $4$ means that as $\overline{abcdef} = \overline{abcd}\times 100 + \overline {ef}$ that $\overline {ef} =10e + f$ be divisible by $4$.  But if $e$ is already being restricted to being even then $10e +f = 20\cdot \frac e2 + f$ and this reduces to a single restriction on $f$; that $f$ is divisible by $4$.  Or that $f = 0,4,8$.
So the restriction that $a,b,c,d,e,f$ are all even and that $\overline{abcdef}$ is divisible by $12$ reduces to a single restriction on $f$ (assuming $a,b,c,d,e,$ are all even); that  $f=0,4,8$ and that $f\equiv -(a+b+c+d+e)$.
But $0\equiv 0\pmod 3$ and $4\equiv 1\pmod 3$ and $8\equiv 2\pmod 3$ so if $a,b,c,d,e$ "run free" then our single restriction on $f$ can be expressed precisely as: $f=\begin{cases}0&a+b+c+d+e \equiv 0 \pmod 3\\4&a+b+c+d+e\equiv -1\equiv 2\pmod 3\\8&a+b+c+d+e\equiv -2 \equiv 1 \pmod 3\end{cases}$
So our restrictions are:

*

*$\overline{abcdef}$ is six digits.  So $a \ne 0$ and $a$ is even.  There are $4$ options.

*$b,c,d,e$ are even.  There are $5$ options each or $5^4$ total.

*$f=\begin{cases}0&a+b+c+d+e \equiv 0 \pmod 3\\4&a+b+c+d+e\equiv -1\equiv 2\pmod 3\\8&a+b+c+d+e\equiv -2 \equiv 1 \pmod 3\end{cases}$. There is $1$ option.

So there are $4\cdot 5^4 = 2500$ such numbers.
</s>