The Four Squares Theorem is a theorem in number theory
shown by Lagrange in 1770. This theorem states that every positive
whole number is a sum of four perfect squares. For example,
11 = 32+ 12 + 12 + 02
19 = 32+ 32 + 12 + 02
87 = 22+ 32 + 52 + 72
1197 = 322+ 122 + 52 + 22
As seen from above, the four perfect squares may include
duplicates or zeros.
For small numbers, it's usually easy to find the four
perfect squares that sums up to the number of interest. But for
large numbers, the four perfect squares are usually hard to find.
More Mathematical Recreations