Polygonal number (source code)

= Polygonal number
{title2=$P_{s,n}$}

For <integers> $s\geq3$ and $n\geq1$, the $n$th $s$-gonal number is
$$
P_{s,n}=\frac{(s-2)n^2-(s-4)n}{2}=n+(s-2)\frac{n(n-1)}2.
$$
These <figurate numbers> begin at one, and their successive increments form an <arithmetic progression>:
$$
P_{s,n}-P_{s,n-1}=1+(s-2)(n-1).
$$
Summing these increments proves the formula. For $s=3,4,5,6$, it gives <triangular numbers>, <square numbers>, <pentagonal numbers> and <hexagonal numbers>. For example, the first three <pentagonal numbers> are $1,5,12$, whose successive increments are four and seven. Increasing the number of polygon sides changes the step between increments while keeping this common quadratic structure.