Why any square can be written in this form? I have noticed that all squares, at least up to $19 ^ 2$ can be written as: $a^2 = 5k + p$, where $a \in \mathbb{Z}+\neq 1$ and $k  \in \mathbb{Z}+$ and $p = \{0,\pm1\}$
Some examples:
$4^2 = 5 \cdot 3 + 1$
$13^2 = 5 \cdot 34 - 1 $
What is the intuitive and formal proof to see this?
 A: The formal reason for this is that $a^2$, modulo $5$, has remainders of $0,1,4$ only (i.e., $0^2 \equiv 0 \pmod 5$, $1^2 \equiv 4^2 \equiv 1 \pmod 5$ and $2^2 \equiv 3^2 \equiv 4 \pmod 5$). For these, the amount to add to get a multiple of $5$ would be $0,-1,1$.
As for what may be considered an "intuitive" way, consider that $x^2 \equiv (-x)^2 \pmod 5$ (actually, it's true for all moduli). Thus, you have the possible remainders, when divide by $5$, being those of just $0$, $1$ (as $-1 \equiv 4 \pmod 5$ gives the same remainder) and $2$ (as $-2 \equiv 3 \pmod 5$ gives the same remainder). Checking just these $3$ values, you get $0,1,4$, as mentioned above.
A: Every integer is of one of the forms 
$$5k, 5k+1, 5k+2, 5k+3, 5k+4.$$
If you square these you get
$$25k^2=5n$$
$$25k^2+10k+1 = 5n+1$$
$$25k^2+20k+4= 5n+4$$
$$25k^2+30k+9 = 5n+4$$
$$25k^2+40k+16 = 5n+1$$
A: Every integer $a$ is congruent, modulo $5$ to $0,\pm 1$ or $\pm2$. So its square is
$$a^2\equiv \begin{cases}0^2=0&\text{or} \\(\pm 1)^2=1&\text{or} \\(\pm2)^2=4\rlap{\equiv -1,}\end{cases}\mod 5.$$
A: Say we want to consider $b^2$.  We look at $b$ modulo $5$, $b = 5c+d$, where $c$ is an integer and $d$ is one of $0$, $1$, $2$, $3$, or $4$.  Then 
$$  b^2 = (5c+d)^2 = 25c^2 + 10c d + d^2  \text{.}  $$
The part "$25 c^2 + 10 c d$" is a multiple of $5$, so can be collected into $k$.  This leaves $d^2$.  We show in a table that $d^2$ is congruent to $0$ or $\pm 1$ modulo $5$ for each choice of $d$.  \begin{align*}
&d & &d^2  \\
&0 & &0  \\
&1 & &1  \\
&2 & &4  \cong -1 \pmod{5}  \\
&3 & &9  \cong -1 \pmod{5}  \\
&4 & &16 \cong 1 \pmod{5}  \text{.}
\end{align*}
In addition to showing that every $b$ squares to a multiple of $5$ or $\pm 1$ from a multiple of $5$, we can read from the table which of these cases occurs  since $d \cong b \pmod{5}$.
