@gutenberg_org @wikipedia
From https://mathworld.wolfram.com/FermatsPolygonalNumberTheorem.html (ellipses mine):
"Fermat's Polygonal Number Theorem
In 1638, Fermat proposed that every positive integer is a sum of at most three triangular numbers, four square numbers, five pentagonal numbers, and n n-polygonal numbers. Fermat claimed to have a proof of this result, although Fermat's proof has never been found. Gauss proved the triangular case, and noted the event in his diary on July 10, 1796, ... (Duke 1997). More specifically, a number is a sum of three squares iff it is not of the form 4^b(8m+7) for b>=0, as first proved by Legendre in 1798.
Euler was unable to prove the square case of Fermat's theorem, but he left partial results which were subsequently used by Lagrange. The square case was finally proved by Jacobi and independently by Lagrange in 1772. It is therefore sometimes known as Lagrange's four-square theorem. In 1813, Cauchy proved the proposition in its entirety."