TITLE: Prove that for every prime number $p>3$, $4p^2+1$ can be written as the sum of three square numbers
QUESTION [5 upvotes]: Given that $p>3$ prove that $4p^2+1$ can be written as the sum of three distinct positive square numbers. 
Plugging in $5$ I get $101=49+36+16=7^2+6^2+4^2$
I also know that all primes greater than $3$ can be written in the form $3k+1$ and $3k+2$ but plugging those values in I get:
$36k^2+24k+5$,  $36k^2+48k+17$ and the solution probably lies in arranging these numbers in such a way that we get the desired squares, but I can't come up with a combination ,or is my "idea" not even in the right direction?

REPLY [6 votes]: We know that $p=6n\pm1$. Here
$$
4(6n-1)^2+1=144n^2-48n+5=(8n-1)^2+(8n-2)^2+(4n)^2.
$$
You figure out what changes are needed to do the case with plus signs.