# Pyramidal number

Geometric representation of the square pyramidal number 1 + 4 + 9 + 16 = 30.

A pyramidal number is a figurate number that represents a pyramid with a polygonal base and a given number of triangular sides. A pyramidal number is the number of points in a pyramid where each layer of the pyramid is an r-sided polygon of points.[1] The term often refers to square pyramidal numbers, which have a square base with four sides, but it can also refer to pyramids with three or more sides.[2] The numbers of points in the base (and in parallel layers to the base) are given by polygonal numbers of the given number of sides, while the numbers of points in each triangular side is given by a triangular number. It is possible to extend the pyramidal numbers to higher dimensions.

## Formula

The formula for the nth r-gonal pyramidal number is

${\displaystyle P_{n}^{r}={\frac {3n^{2}+n^{3}(r-2)-n(r-5)}{6}},}$

where r ∈ [[${\displaystyle \mathbb {N} }$]], r ≥ 3. [1]

This formula can be factored:

{\displaystyle {\begin{aligned}P_{n}^{r}={\frac {n(n+1){\bigl (}n(r-2)-(r-5){\bigr )}}{(2)(3)}}=\left({\frac {n(n+1)}{2}}\right)\left({\frac {n(r-2)-(r-5)}{3}}\right)=T_{n}\ \left({\frac {n(r-2)-(r-5)}{3}}\right)\end{aligned}},}

where Tn is the nth triangular number.

## Sequences

The first few triangular pyramidal numbers (equivalently, tetrahedral numbers) are:

1, 4, 10, 20, 35, 56, 84, 120, 165, 220, ... (sequence A000292 in the OEIS)

The first few square pyramidal numbers are:

1, 5, 14, 30, 55, 91, 140, 204, 285, 385, 506, 650, 819, ... (sequence A000330 in the OEIS).

The first few pentagonal pyramidal numbers are:

1, 6, 18, 40, 75, 126, 196, 288, 405, 550, 726, 936, 1183, 1470, 1800, 2176, 2601, 3078, 3610, 4200, 4851, 5566, 6348, 7200, 8125, 9126 (sequence A002411 in the OEIS).

The first few hexagonal pyramidal numbers are:

1, 7, 22, 50, 95, 161, 252, 372, 525, 715, 946, 1222, 1547, 1925 (sequence A002412 in the OEIS).

The first few heptagonal pyramidal numbers are:[3]

1, 8, 26, 60, 115, 196, 308, 456, 645, 880, 1166, 1508, 1911, ... (sequence A002413 in the OEIS)

## References

1. ^ a b Weisstein, Eric W. "Pyramidal Number". MathWorld.
2. ^ Sloane, N. J. A. (ed.). "Sequence A002414". The On-Line Encyclopedia of Integer Sequences. OEIS Foundation.
3. ^ Beiler, Albert H. (1966), Recreations in the Theory of Numbers: The Queen of Mathematics Entertains, Courier Dover Publications, p. 194, ISBN 9780486210964.