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:
 * $\map P {k, n} = \dfrac n 2 \paren {\paren {k - 2} n - k + 4}$

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:

as required.