# Divisibility by 4

I was asked to find divisibility tests for 2,3, and 4.

I could do this for 2 and 3, but for 4.

I could come only as far as:

let $a_na_{n-1}\cdots a_1a_0$ be the $n$ digit number.

Now from the hundredth digit onwards, the number is divisible by 4 when we express it as sum of digits.

So, the only part of the proof that's left is to prove that $10a_1+a_0$ is divisible by 4.

So if we show that this happens only when the number $a_1a_0$ is divisible by 4, the proof is complete.

So the best way to show it is by just taking all combinations of $a_1,a_0$ or is there a better way?

• If $a_1$ is even, then the number is divisible by $4$ if and only if $a_0$ is divisible by $4$ ($a_0=0$, $4$, or $8$). If $a_1$ is odd, then the number is divisible by $4$ if and only if $a_0$ is even and not divisible by $4$ ($a_0=2$ or $a_2=6$). This because $20$ is a multiple of $4$, and $10$ leaves a remainder of $2$. – Arturo Magidin Nov 13 '11 at 8:57
• $10a_1 + a_0$ is by definition the number represented by the decimal string "$a_1a_0$", so I don't see any problem. Indeed, a number is divisible by 4 iff the number represented by the last 2 digits is. – Henno Brandsma Nov 13 '11 at 8:59
• @kira. $a_na_{n-1}\cdots a_1a_0$ is an $(n+1)$-digit number (not $n$-digit). – matt Nov 13 '11 at 9:02
• Why not just say $a_1a_0$ is divisible by 4? This would be an elementary "test". You could also use $a_1a_0$ is div. by 2 and the quotient is div. by 2. – David Mitra Nov 13 '11 at 9:14
• @matt ya sorry for the mistake – Bach Nov 13 '11 at 9:28

Note that $10a_1+a_0\equiv2a_1+a_0$ (mod 4). So for divisibility by 4, $a_0$ must be even and in this case $2a_1+a_0=2(a_1+\frac{a_0}{2})$. So, $a_1$ and $\frac{a0}{2}$ must be of same parity (means both are either even, or odd).