Square pyramidal number

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

In mathematics, a pyramid number, or square pyramidal number, is a natural number that counts the stacked spheres in a pyramid with a square base. The study of these numbers goes back to Archimedes and Fibonacci. They are part of a broader topic of figurate numbers representing the numbers of points forming regular patterns within different shapes.

As well as counting spheres in a pyramid, these numbers can be described algebraically as a sum of the first positive square numbers, or as the values of a cubic polynomial. They can be used to solve several other counting problems, including counting squares in a square grid and counting acute triangles formed from the vertices of an odd regular polygon. They equal the sums of consecutive tetrahedral numbers, and are one-fourth of a larger tetrahedral number. The sum of two consecutive square pyramidal numbers is an octahedral number.