*** Welcome to piglix ***

Legendre's three-square theorem


In mathematics, Legendre's three-square theorem states that a natural number can be represented as the sum of three squares of integers

if and only if n is not of the form for integers a and b.

The first numbers that cannot be expressed as the sum of three squares (i.e. numbers that can be expressed as ) are

Pierre de Fermat gave a criterion for numbers of the form 3a + 1 to be a sum of three squares essentially equivalent to Legendre's theorem, but did not provide a proof. N. Beguelin noticed in 1774 that every positive integer which is neither of the form 8n + 7, nor of the form 4n, is the sum of three squares, but did not provide a satisfactory proof. In 1796 Gauss proved his Eureka theorem that every positive integer n is the sum of 3 triangular numbers; this is equivalent to the fact that 8n + 3 is a sum of three squares. In 1797 or 1798 A.-M. Legendre obtained the first proof of his 3 square theorem. In 1813, A. L. Cauchy noted that Legendre's theorem is equivalent to the statement in the introduction above. Previously, in 1801, C. F. Gauss had obtained a more general result, containing Legendre theorem of 1797–8 as a corollary. In particular, Gauss counted the number of solutions of the expression of an integer as a sum of three squares, and this is a generalisation of yet another result of Legendre, whose proof is incomplete. This last fact appears to be the reason for later incorrect claims according to which Legendre's proof of the three-square theorem was defective and had to be completed by Gauss.


...
Wikipedia

...