Definition:Polygonal Number

Definition
A polygonal number is an integer defined recursively as follows:


 * $\forall k \in \Z, k \ge 2: \forall n \in Z, n \ge 0: P \left({k, n}\right) = \begin{cases}

0 & : n = 0 \\ P \left({k, n-1}\right) + \left({k-2}\right) \left({n-1}\right) + 1 & : n > 0 \end{cases}$

Alternatively, the formula can be given as $P \left({k, n}\right) = P \left({k, n-1}\right) + n \left({k-2}\right) - \left({k-3}\right)$.

The name comes from the fact that such numbers can be "arranged" into regular polygonal shapes.

For a given $k$, polygonal numbers are referred to by the name of the appropriate $k$-sided polygon.

For large $k$, they will therefore be called (when used) "$k$-gonal numbers".

Triangular Numbers
When $k = 3$, the recurrence relation is:


 * $T_n = P \left({3, n}\right) = \begin{cases}

0 & : n = 0 \\ T_{n-1} + n & : n > 0 \end{cases}$

See Triangular Number.

Also see the Closed Form for Triangular Numbers.

Square Numbers
When $k = 4$, the recurrence relation is:


 * $S_n = P \left({4, n}\right) = \begin{cases}

0 & : n = 0 \\ S_{n-1} + 2 n - 1 & : n > 0 \end{cases}$

See Square Number.

Also see the Odd Number Theorem‎.

Square numbers are of course better known for the fact that $S_n = n^2$.

Pentagonal Numbers
When $k = 5$, the recurrence relation is:


 * $P \left({5, n}\right) = \begin{cases}

0 & : n = 0 \\ P \left({5, n-1}\right) + 3 n - 2 & : n > 0 \end{cases}$

See Pentagonal Number.

Degenerate Case
When $k = 2$, the polygon degenerates into a straight line, and the recurrence formula becomes:


 * $P \left({2, n}\right) = \begin{cases}

0 & : n = 0 \\ P \left({2, n-1}\right) + 0 \times \left({n-1}\right) + 1 & : n > 0 \end{cases}$

... hence $P \left({2, n}\right) = P \left({2, n-1}\right) + 1$ and the sequence goes:
 * $0, 1, 2, 3, \ldots$

which is of course the natural numbers.