Closed Form for Polygonal Numbers

Theorem
Let $P \left({k, n}\right)$ be the $n$th $k$-gonal number.

The closed-form expression for $P \left({k, n}\right)$ is given by:
 * $P \left({k, n}\right) = \dfrac n 2 \left({\left({k - 2}\right) n - k + 4}\right)$

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

$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}$

Then:


 * $\left({\left({k - 2}\right) \left({j - 1}\right) + 1}\right)$

is an arithmetic progression.

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

Hence:

as required.