## Task 19/64

What is the remainder when a square number is divided by 8?
We make a case distinction

1. The square number is even: $z^{2}=2 m$.

Then $z$ is certainly even as well: $z=2 n$ and it holds that $z^{2}=(2 n)^{2}=4 n^{2}$
a) $n=2 k: z^{2}=4 n^{2}=4 \cdot 4 k^{2}=16 k^{2}$. The square number leaves a remainder of 0 when divided by 8.
b) $n=2 k+1: z^{2}=4 n^{2}=4\left(4 k^{2}+4 k+1\right)=16 k^{2}+16 k+4$. The square number leaves a remainder of 4 when divided by 8.

2. The square number is odd: $z^{2}=2 m+1$.

Then $z$ is certainly odd as well: $z=2 n+1$ and it holds that $z^{2}=(2 n+1)^{2}=4 n^{2}+4 n+1$. We rearrange the last expression: $4 n^{2}+4 n+1=4 n(n+1)+1$.
a) $n=2 k: 4 n(n+1)=4(2 k)(2 k+1)=8 k(2 k+1)$; this expression is divisible by 8, so the square number leaves a remainder of 1 when divided by 8.
b) $n=2 k+1: 4 n(n+1)=4(2 k+1)(2 k+2)=8(2 k+1)(k+1)$. This expression is also divisible by 8, and the same applies as in 2a).

It follows: A square number leaves a remainder of 0 when divided by 8 if the base is divisible by 4; it leaves a remainder of 4 if the base is divisible by 2 and a remainder of 1 in all other cases (i.e., if the base is odd).

In the above considerations, $m, n$, and $k$ (as can be inferred from the context) are always some natural numbers, including zero.