A pyramidal number is the number of points in a pyramid with a polygonal base and triangular sides.^{[1]} The term often refers to square pyramidal numbers, which have a square base with four sides, but it can also refer to a pyramid with any number of sides.^{[2]} The numbers of points in the base and in layers parallel 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