Historically, Wikipedia goes on to say that:
From examples given in the ''Arithmetica'' it is clear that Diophantus was aware of the theorem. This book was translated in 1621 into Latin by Claude Gaspard Bachet de Méziriac, who stated the theorem in the notes of his translation. But the theorem was not proved until 1770 by Lagrange.
Adrien-Marie Legendre completed the theorem in 1797–8 with his Legendre's three-square theorem, by proving that a positive integer can be expressed as the sum of three squares if and only if it is not of the formfor integers and . Later, in 1834, Carl Gustav Jakob Jacobi discovered a simple formula for the number of representations of an integer as the sum of four squares with his own Jacobi's four-square theorem.
The formula is also linked to Descartes' theorem of four "kissing circles", which involves the sum of the squares of the curvatures of four circles. This is also linked to Apollonian gaskets, which were more recently related to the Ramanujan–Petersson conjecture.
Getting back to , it turns out to be a member of OEIS A243580: integers of the form that can be written as a sum of four distinct squares of the form , where . The particular value of here is so that we have: There are many proofs of the theorem and two are described in the Wikipedia article. They seem complicated and I haven't delved into them. However, what's of particular interest in the article is the number of ways in which a number can be represented as a sum of four squares, based on the sum (rather than the number) of divisors. There is a rule for the number of ways that a number can be written as a sum of two squares but this is based on powers of its prime divisors. The rule for the four squares is that the number is:
times the sum of the divisors of the number if it is odd and times the sum of the odd divisors of the number if it is even
These numbers count squares in different positions and also include negative numbers. Thus the odd number , that has a sum of divisors equal to , has eight possible representations:
with the 1 in four possible positions with the -1 in four possible positions
The number with a sum of would have a staggering possible representations as a sum of four squares. None of these representations would involve zero because cannot be expressed as a sum of two or three squares. It's easier to work initially with smaller numbers to begin with so let's take with a sum of divisors of . I've chosen because it's equal to and thus cannot be represented as a sum of three squares. Thus should have representations. This is indeed the case. However, if we don't regard different positions as being different, then there are only twelve arrangements. If we exclude negative numbers, there is only one arrangement: .
Moving on to , there is again only one positive arrangement and that is . With , there are two positive arrangements: and . Being primes, the sums of divisors of and are and respectively and so by Jacobi's theorem there are and possible arrangements. It would seem that the theorem is of little practical use but interesting to explore nonetheless.