gives the n^(th) triangular number .


gives the n^(th) r-gonal number .


  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • PolygonalNumber[n] is generically defined as TemplateBox[{{n, +, 1}, 2}, Binomial].
  • PolygonalNumber[r,n] is generically defined as .
  • PolygonalNumber[r,n] can be interpreted as the number of points arranged in the form of n-1 polygons of r sides. For instance for r=3 and n=4:
  • PolygonalNumber automatically threads over lists.


open allclose all

Basic Examples  (2)

Return the first 10 triangular numbers:

Return the tenth r-gonal number of several regular polygons:

Scope  (4)

Use PolygonalNumber with integer arguments:

Use RegularPolygon to specify the number of sides of a regular polygon:

PolygonalNumber automatically threads over lists:

Use PolygonalNumber with symbolic input:

Applications  (2)

Generate random octagonal numbers:

Plot the first 50 triangular, square, and pentagonal numbers:

Properties & Relations  (9)

The 0^(th) polygonal number of any regular polygon is zero:

The first polygonal number of any regular polygon is one:

Every other triangular number is a hexagonal number:

The sum of two consecutive triangular numbers is a square number:

Every pentagonal number is one third of a triangular number:

The difference between the n^(th) r-gonal number and the n^(th) (r+1)-gonal number is the (n-1)^(th) triangular number:

Even perfect numbers are triangular numbers related to Mersenne prime exponents:

Even perfect numbers are hexagonal numbers related to Mersenne prime exponents:

All even perfect numbers greater than 6 are of the following form for some value of k:

Neat Examples  (1)

Visualize polygonal numbers:

Introduced in 2016