# Pattern in digits of sums of consecutive squares

I am interested in patterns in square numbers as well as the reasons behind them and I can't seem to figure out (also how to prove) why do the sums of two consecutive squares only end in digits 1, 3 and 5. Could someone please help me? I don't have university level knowledge of mathematics yet so if the answer includes it, could you briefly explain the steps it took to get the answer? Thank you!

• Take mod 10. You only have to consider the last digits of the consecutive numbers, irresepective of the number of digits. – N.S.JOHN May 15 '16 at 9:41

## 2 Answers

Let $f(n)=n^2+(n+1)^2$ denote the sum of the $n$th and the $(n+1)$st square. Then \begin{align}f(n+5)-f(n)&=(n+5)^2+(n+6)^2-n^2-(n+1)^2\\ &=(n^2+10n+25)+(n^2+12n+36)-n^2-(n^2+2n+1)\\ &=20n+60 \end{align} is a multiple of $10$ so that the last digit of $f(n+5)$ is tha same as that of $f(n)$. Also, \begin{align}f(4-n)-f(n)&=(4-n)^2+(5-n)^2-n^2-(n+1)^2\\ &=(n^2-8n+16)+(n^2-10n+25)-n^2-(n^2+2n+1)\\ &=-20n+40\end{align} so that the last digit of $f(4-n)$ equals that of $f(n)$. Combining both results,all possible last digits of $f(n)$ occur already among $f(0)=1,f(1)=5,f(2)=13$.

Consider the following cases:

• $n\equiv\color\red0\pmod{10} \implies n^2+(n+1)^2\equiv\color\red0^2+(\color\red0+1)^2\equiv 0+ 1\equiv1\pmod{10}$
• $n\equiv\color\red1\pmod{10} \implies n^2+(n+1)^2\equiv\color\red1^2+(\color\red1+1)^2\equiv 1+ 4\equiv5\pmod{10}$
• $n\equiv\color\red2\pmod{10} \implies n^2+(n+1)^2\equiv\color\red2^2+(\color\red2+1)^2\equiv 4+ 9\equiv3\pmod{10}$
• $n\equiv\color\red3\pmod{10} \implies n^2+(n+1)^2\equiv\color\red3^2+(\color\red3+1)^2\equiv 9+ 16\equiv5\pmod{10}$
• $n\equiv\color\red4\pmod{10} \implies n^2+(n+1)^2\equiv\color\red4^2+(\color\red4+1)^2\equiv16+ 25\equiv1\pmod{10}$
• $n\equiv\color\red5\pmod{10} \implies n^2+(n+1)^2\equiv\color\red5^2+(\color\red5+1)^2\equiv25+ 36\equiv1\pmod{10}$
• $n\equiv\color\red6\pmod{10} \implies n^2+(n+1)^2\equiv\color\red6^2+(\color\red6+1)^2\equiv36+ 49\equiv5\pmod{10}$
• $n\equiv\color\red7\pmod{10} \implies n^2+(n+1)^2\equiv\color\red7^2+(\color\red7+1)^2\equiv49+ 64\equiv3\pmod{10}$
• $n\equiv\color\red8\pmod{10} \implies n^2+(n+1)^2\equiv\color\red8^2+(\color\red8+1)^2\equiv64+ 81\equiv5\pmod{10}$
• $n\equiv\color\red9\pmod{10} \implies n^2+(n+1)^2\equiv\color\red9^2+(\color\red9+1)^2\equiv81+100\equiv1\pmod{10}$