# Fermat's Polygonal Number Theorem

###### This wiki is incomplete.

**Fermat's polygonal number theorem** states that every positive integer can be written as the sum of at most \(n\) \(n\)-gon numbers. This implies that a positive integer can be written as the sum of at most 3 triangular numbers, 4 square numbers, and so on.

- \(17=1+6+10\) (triangular numbers)
- \(17=1+16\) (square numbers)
- \(17=5+12\) (pentagonal numbers)

The case for \(n=3\) was proved by Gauss and the proof is given below.

From Lagrange's three-square theorem, we know that a number \(r\) of the form \(8n+7\) cannot be represented as the sum of 3 square numbers. This implies that numbers of the form \(8n+3\) can be written as the sum of 3 squares.

The squares mod 8 are \((0,1)\) and \((4).\)

For \(r\) to be the sum of three squares, the squares need to be congruent to \(1 \pmod 8:\)

\[\begin{align} r&=(2x+1)^2+(2y+1)^2+(2z+1)^2\\ 8n+3&=4x^2+4x+4y^2+4y+4z^2+4z+3\\ 8n&=4x(x+1)+4y(y+1)+4z(z+1)\\ n&=\frac{x(x+1)}{2}+\frac{y(y+1)}{2}+\frac{z(z+1)}{2}. \end{align}\]

All triangular numbers are of the form \(\frac{a(a+1)}{2}.\) Thus, \(n\) can be written as the sum of three triangular numbers. \(_\square\)

**Cite as:**Fermat's Polygonal Number Theorem.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/fermats-polygonal-number-theorem/