Closed Form for Polygonal Numbers

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

Then the closed-form expression for $P \left({k, n}\right)$ is given by:
 * $\displaystyle P \left({k, n}\right) = \frac {n \left({2 + \left({n-1}\right)\left({k-2}\right)}\right)} 2$

Proof
We have that:

$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 from Sum of Arithmetic Progression:


 * $\displaystyle P \left({k, n}\right) = \sum_{j \mathop = 1}^n \left({\left({k-2}\right)\left({j-1}\right) + 1}\right) = \frac {n \left({2 + \left({n-1}\right)\left({k-2}\right)}\right)} 2$

as desired.