# Divisibility test for $4$

Claim: A number is divisible by $4$ if and only if the number formed by the last two digits is divisible by $4$.

Here's where I've gotten so far.

Let $x$ be an $(n+1)$-digit number. So $x= a_na_{n-1} \dots a_2a_1a_0$. If $a_1 = 0$ and $a_0 =0$, then $x$ is a multiple of $100$ and therefore clearly divisible by $4$. So we must deal with the case when $(a_1 \neq 0 \lor a_0 \neq 0)$.

Then if $10a_1 + a_0 \equiv 0 \mod 4$ is true, then $x$ is divisible by $4$.

Do I need to do anything else or is this done? I feel like it's not quite complete, but I'm not sure how to proceed.

-
I dont see how it can be 'if and only if...' when numbers like 12 dont have the last digits divisible by 4 and yet the number itself is divisible by 4. –  Jakob Feb 14 '14 at 15:27
@Jakob The last two digits of $12$ is the number $12$. As in, $6\cdot 2$. That is divisible by four, so $12$ is divisible by $4$, just like $12,312,487,269,512$ is divisible by $4$, since it ends with $12$. –  Arthur Feb 14 '14 at 15:29
...or $\;24\;$ , or even worse: $\;36\;$ . I think the OP may have meant to say the number's divisible by four iff the number formed by its two last digits is. –  DonAntonio Feb 14 '14 at 15:29
@Arthur, that's not what the OP wrote. –  DonAntonio Feb 14 '14 at 15:31
These are similar questions to what I had when I read the problem. I've decided to interpret it the way Arthur has. I'll make an edit. –  Tyler Murphy Feb 14 '14 at 16:00

Pick $h, j \in \{0,1,\dots 9\}$ then $$100k + 10h + j \equiv 10h+j \mod 4$$ because $4 \mid 100$

So we have $$100k + 10h + j \equiv 0 \mod 4 \ \Leftrightarrow \ 10h + j \equiv 0 \mod 4$$

-

$\begin{eqnarray}{\bf Hint}\ \ {\rm mod}\,\ \color{#c00}4\!: && a_0 + 10 a_1 +\ 10^2 a_2 +\ 10^3 a_3 +\, \cdots\\ &\equiv\ & a_0 + 10 a_1 +\ \color{#0a0}{10^2} (a_2 + 10 \ a_3 +\, \cdots)\\ &\equiv\ & a_0 + 10 a_1\, {\rm by}\ \color{#0a0}{10^2}\! = \color{#c00}4\cdot 25\equiv 0\end{eqnarray}$

-

All integers can be written in the form: $$a_{0}10^n+a_{1}10^{n-1}+...+a_{n-1}10^1+a_{n}$$ That can be rewritten as: $$100(a_{0}10^{n-2}+a_{1}10^{n-3}+...+a_{n-3}10^1+a_{n-2})+a_{n-1}10^1+a_{n}$$ $$=4\times 25(a_{0}10^{n-2}+a_{1}10^{n-3}+...+a_{n-3}10^1+a_{n-2})+a_{n-1}10^1+a_{n}$$ Since the term $(a_{0}10^{n-2}+a_{1}10^{n-3}+...+a_{n-3}10^1+a_{n-2})$ is divisible by $4$, then $a_{0}10^n+a_{1}10^{n-1}+...+a_{n-1}10^1+a_{n}$ is divisible by 4 if and only if the last two digits, $a_{n-1}10^1$ and $a_{n}$, can combine together to form a number divisible by $4$. This concludes the proof.

-