# Closed Form for Polygonal Numbers

## Theorem

Let $\map P {k, n}$ be the $n$th $k$-gonal number.

The closed-form expression for $\map P {k, n}$ is given by:

 $\displaystyle \map P {k, n}$ $=$ $\displaystyle \frac n 2 \paren {\paren {k - 2} n - k + 4}$ $\displaystyle$ $=$ $\displaystyle \frac {k - 2} 2 \paren {n^2 - n} + n$

## Proof

By definition of the $n$th $k$-gonal number:

$\map P {k, n} = \begin{cases} 0 & : n = 0 \\ \map P {k, n - 1} + \paren {k - 2} \paren {n - 1} + 1 & : n > 0 \end{cases}$

Then:

$\paren {\paren {k - 2} \paren {j - 1} + 1}$

is an arithmetic sequence.

Its initial term $a$ is $1$, and its common difference $d$ is $k - 2$.

Hence:

 $\displaystyle \map P {k, n}$ $=$ $\displaystyle \sum_{j \mathop = 1}^n \paren {\paren {k - 2} \paren {j - 1} + 1}$ Sum of Arithmetic Sequence $\displaystyle$ $=$ $\displaystyle \frac {n \paren {2 + \paren {n - 1} \paren {k - 2} } } 2$ $\displaystyle$ $=$ $\displaystyle \frac n 2 \paren {\paren {k - 2} n - \paren {k - 2} + 2}$ $\displaystyle$ $=$ $\displaystyle \frac n 2 \paren {\paren {k - 2} n - k + 4}$

as required.

$\blacksquare$

## Examples

The closed-form expression for $\map P {k, n}$ for various $k$ can be expressed as:

 $\displaystyle k = 3: \ \$ $\displaystyle \frac n 2 \paren {\paren {3 - 2} n - 3 + 4}$ $=$ $\displaystyle \frac n 2 \paren {n + 1}$ $\displaystyle \quad = \frac {n \paren {n + 1} } 2$ Definition of Triangular Number $\displaystyle k = 4: \ \$ $\displaystyle \frac n 2 \paren {\paren {4 - 2} n - 4 + 4}$ $=$ $\displaystyle \frac n 2 \paren {2 n - 0}$ $\displaystyle \quad = n^2$ Definition of Square Number $\displaystyle k = 5: \ \$ $\displaystyle \frac n 2 \paren {\paren {5 - 2} n - 5 + 4}$ $=$ $\displaystyle \frac n 2 \paren {3 n - 1}$ $\displaystyle \quad = \frac {n \paren {3 n - 1} } 2$ Definition of Pentagonal Number $\displaystyle k = 6: \ \$ $\displaystyle \frac n 2 \paren {\paren {6 - 2} n - 6 + 4}$ $=$ $\displaystyle \frac n 2 \paren {4 n - 2}$ $\displaystyle \quad = n \paren {2 n - 1}$ Definition of Hexagonal Number $\displaystyle k = 7: \ \$ $\displaystyle \frac n 2 \paren {\paren {7 - 2} n - 7 + 4}$ $=$ $\displaystyle \frac n 2 \paren {5 n - 3}$ $\displaystyle \quad = \frac {n \paren {5 n - 3} } 2$ Definition of Heptagonal Number $\displaystyle k = 8: \ \$ $\displaystyle \frac n 2 \paren {\paren {8 - 2} n - 8 + 4}$ $=$ $\displaystyle \frac n 2 \paren {6 n - 4}$ $\displaystyle \quad = n \paren {3 n - 2}$ Definition of Octagonal Number

and so on.