Square pyramidal number (source code)

= Square pyramidal number
{wiki=Square_pyramidal_number}

A square pyramidal number is a figurate number that represents the total number of stacked squares in a pyramid with a square base. The \\(n\\)-th square pyramidal number counts the number of squares in a pyramid that has \\(n\\) layers, where the bottom layer is \\(n \\times n\\) and each layer above decreases by 1 in both dimensions until the top layer, which is \\(1 \\times 1\\).