A theorem, also known as Bachet's conjecture, which Bachet inferred from a lack of a necessary condition being stated by Diophantus. It states that every positive
integer can be written as the sum of at most four squares. Although the theorem was proved by Fermat
using infinite descent, the proof was suppressed. Euler was unable to prove the theorem.
The first published proof was given by Lagrange in 1770 and made use of the Euler
four-square identity.
Lagrange proved that , where 4 may be reduced to 3 except for numbers of
the form , as proved by Legendre in 1798 (Nagell 1951, p. 194;
Wells 1986, pp. 48 and 56; Hardy 1999, p. 12; Savin 2000).