Lagrange's four-square theorem is 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).
Chae et al. (2026) determined how the bound changes if a single square number
is forbidden, with
a positive integer.
For each representable
,
take the least number of allowed squares that sum to
, and let
be the largest such minimum. Then
,
,
and
for
,
,
or
with
in the two powers-of-two families. All other positive
have
.
In particular, every positive integer is a sum
of at most four squares without using
,
answering Newman's question (Chae
et al. 2026).
For , every positive
integer is representable because
is allowed. For
,
the only nonrepresentable positive integers are 1, 2, 3, 5, 6, 7, 10, 11, 14, 15,
19, and 23. For every positive
,
four allowed squares suffice whenever
(Chae et al. 2026). These representations
may use fewer than four nonzero squares.