Definition:Pentagonal Number

Pentagonal numbers are those denumerating a collection of objects which can be arranged in the form of a regular pentagon.

They are otherwise called pentagon numbers.

Or we can just say that a number is pentagonal.

They can be denoted $$P_1, P_2, P_3, \ldots$$, and they are formally defined as:
 * $$P_n = \sum_{i=1}^n [3(i - 1) + 1] = 1 + 4 + \cdots + \left({3 \left({n-2}\right) + 1}\right) + \left({3 \left({n-1}\right) + 1}\right)$$.

Thus $$P_0 = 0$$ and $$P_1 = 1$$.



The second pentagonal number: $$P_2 = 1 + 4 = 5$$.



The third pentagonal number: $$P_3 = 1 + 4 + 7 = 12$$.

Recurrence Formula
It can be seen directly from the above that:
 * $$P_n = \begin{cases}

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

Closed Form
From Closed Form for Polygonal Number‎s, we have:
 * $$P_n = \frac {n \left({2 + 3 \left({n-1}\right)}\right)} 2$$