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?
 A: The tens and unit digits of such numbers will be $x0$, $x4$, $x8$. These are $5\cdot 3=15$ in all and five of these are $0 \pmod 3$, five $1 \pmod 3$  and five $2 \pmod 3$.
The first four digits can be written down in $4 \cdot 5^3=500$ ways, each of which is $0,1,2 \pmod 3$.
We do not need to know how many of them are which modulo $3$. Since each block of four digits can be appended with appropriate block of last two digits ($0$ with $0$, $1$ with $2$ and $2$ with $1$ modulo $3$) in $5$ valid ways, desired number of six-digit numbers is
$$500 \times 5 =2500$$
A: 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.
