# Polygonal number

In mathematics, a polygonal number is a number that counts dots arranged in the shape of a regular polygon$^{:2-3}$. These are one type of 2-dimensional figurate numbers.
Polygonal numbers were first studied during the 6th century BC by the Ancient Greeks, who investigated and discussed properties of oblong, triangular, and square numbers$^{:1}$.

## Definition and examples

The number 10 for example, can be arranged as a triangle (see triangular number):
But 10 cannot be arranged as a square. The number 9, on the other hand, can be (see square number):
Some numbers, like 36, can be arranged both as a square and as a triangle (see square triangular number):
By convention, 1 is the first polygonal number for any number of sides. The rule for enlarging the polygon to the next size is to extend two adjacent arms by one point and to then add the required extra sides between those points. In the following diagrams, each extra layer is shown as in red.

### Triangular numbers

The triangular number sequence is the representation of the numbers in the form of equilateral triangle arranged in a series or sequence. These numbers are in a sequence of 1, 3, 6, 10, 15, 21, 28, 36, 45, and so on.

### Square numbers

Polygons with higher numbers of sides, such as pentagons and hexagons, can also be constructed according to this rule, although the dots will no longer form a perfectly regular lattice like above.

### Hexagonal numbers
## Formula

If s is the number of sides in a polygon, the formula for the nth s-gonal number P(s,n) is
    $P(s,n)={\frac {(s-2)n^{2}-(s-4)n}{2}}$
or
    $P(s,n)=(s-2){\frac {n(n-1)}{2}}+n$
The nth s-gonal number is also related to the triangular numbers T$_n$ as follows:
    $P(s,n)=(s-2)T_{n-1}+n=(s-3)T_{n-1}+T_{n}\,.$
Thus:
    ${\begin{aligned}P(s,n+1)-P(s,n)&=(s-2)n+1\,,\\P(s+1,n)-P(s,n)&=T_{n-1}={\frac {n(n-1)}{2}}\,,\\P(s+k,n)-P(s,n)&=kT_{n-1}=k{\frac {n(n-1)}{2}}\,.\end{aligned}}$
For a given s-gonal number P(s,n) = x, one can find n by
    $n={\frac {{\sqrt {8(s-2)x+{(s-4)}^{2}}}+(s-4)}{2(s-2)}}$
and one can find s by
    $s=2+{\frac {2}{n}}\cdot {\frac {x-n}{n-1}}$.

### Every hexagonal number is also a triangular number

Applying the formula above:
    $P(s,n)=(s-2)T_{n-1}+n$
to the case of 6 sides gives:
    $P(6,n)=4T_{n-1}+n$
but since:
    $T_{n-1}={\frac {n(n-1)}{2}}$
it follows that:
    $P(6,n)={\frac {4n(n-1)}{2}}+n={\frac {2n(2n-1)}{2}}=T_{2n-1}$
This shows that the nth hexagonal number P(6,n) is also the (2n − 1)th triangular number T$_{2n−1}$. We can find every hexagonal number by simply taking the odd-numbered triangular numbers:
    1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, ...

## Table of values

The first 6 values in the column "sum of reciprocals", for triangular to octagonal numbers, come from a published solution to the general problem, which also gives a general formula for any number of sides, in terms of the digamma function.
| s | Name | Formula | n | n | n | n | n | n | n | n | n | n | Sum of reciprocals | OEIS number |
| s | Name | Formula | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Sum of reciprocals | OEIS number |
| 2 | Natural (line segment) | ⁠1/2⁠(0n$^2$ + 2n) = n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ∞ (diverges) | A000027 |
| 3 | Triangular | ⁠1/2⁠(n$^2$ + n) | 1 | 3 | 6 | 10 | 15 | 21 | 28 | 36 | 45 | 55 | 2 | A000217 |
| 4 | Square | ⁠1/2⁠(2n$^2$ − 0n) = n$^2$ | 1 | 4 | 9 | 16 | 25 | 36 | 49 | 64 | 81 | 100 | ⁠π$^2$/6⁠ | A000290 |
| 5 | Pentagonal | ⁠1/2⁠(3n$^2$ − n) | 1 | 5 | 12 | 22 | 35 | 51 | 70 | 92 | 117 | 145 | 3 ln 3 − ⁠π√3/3⁠ | A000326 |
| 6 | Hexagonal | ⁠1/2⁠(4n$^2$ − 2n) = 2n$^2$ - n | 1 | 6 | 15 | 28 | 45 | 66 | 91 | 120 | 153 | 190 | 2 ln 2 | A000384 |
| 7 | Heptagonal | ⁠1/2⁠(5n$^2$ − 3n) | 1 | 7 | 18 | 34 | 55 | 81 | 112 | 148 | 189 | 235 | ${\begin{matrix}{\tfrac {2}{3}}\ln 5\\+{\tfrac {{1}+{\sqrt {5}}}{3}}\ln {\tfrac {\sqrt {10-2{\sqrt {5}}}}{2}}\\+{\tfrac {{1}-{\sqrt {5}}}{3}}\ln {\tfrac {\sqrt {10+2{\sqrt {5}}}}{2}}\\+{\tfrac {\pi {\sqrt {25-10{\sqrt {5}}}}}{15}}\end{matrix}}$ | A000566 |
| 8 | Octagonal | ⁠1/2⁠(6n$^2$ − 4n) = 3n$^2$ - 2n | 1 | 8 | 21 | 40 | 65 | 96 | 133 | 176 | 225 | 280 | ⁠3/4⁠ ln 3 + ⁠π√3/12⁠ | A000567 |
| 9 | Nonagonal | ⁠1/2⁠(7n$^2$ − 5n) | 1 | 9 | 24 | 46 | 75 | 111 | 154 | 204 | 261 | 325 | | A001106 |
| 10 | Decagonal | ⁠1/2⁠(8n$^2$ − 6n) = 4n$^2$ - 3n | 1 | 10 | 27 | 52 | 85 | 126 | 175 | 232 | 297 | 370 | ln 2 + ⁠π/6⁠ | A001107 |
| 11 | Hendecagonal | ⁠1/2⁠(9n$^2$ − 7n) | 1 | 11 | 30 | 58 | 95 | 141 | 196 | 260 | 333 | 415 | | A051682 |
| 12 | Dodecagonal | ⁠1/2⁠(10n$^2$ − 8n) | 1 | 12 | 33 | 64 | 105 | 156 | 217 | 288 | 369 | 460 | | A051624 |
| 13 | Tridecagonal | ⁠1/2⁠(11n$^2$ − 9n) | 1 | 13 | 36 | 70 | 115 | 171 | 238 | 316 | 405 | 505 | | A051865 |
| 14 | Tetradecagonal | ⁠1/2⁠(12n$^2$ − 10n) | 1 | 14 | 39 | 76 | 125 | 186 | 259 | 344 | 441 | 550 | ⁠2/5⁠ ln 2 + ⁠3/10⁠ ln 3 + ⁠π√3/10⁠ | A051866 |
| 15 | Pentadecagonal | ⁠1/2⁠(13n$^2$ − 11n) | 1 | 15 | 42 | 82 | 135 | 201 | 280 | 372 | 477 | 595 | | A051867 |
| 16 | Hexadecagonal | ⁠1/2⁠(14n$^2$ − 12n) | 1 | 16 | 45 | 88 | 145 | 216 | 301 | 400 | 513 | 640 | | A051868 |
| 17 | Heptadecagonal | ⁠1/2⁠(15n$^2$ − 13n) | 1 | 17 | 48 | 94 | 155 | 231 | 322 | 428 | 549 | 685 | | A051869 |
| 18 | Octadecagonal | ⁠1/2⁠(16n$^2$ − 14n) | 1 | 18 | 51 | 100 | 165 | 246 | 343 | 456 | 585 | 730 | ⁠4/7⁠ ln 2 − ⁠√2/14⁠ ln (3 − 2√2) + ⁠π(1 + √2)/14⁠ | A051870 |
| 19 | Enneadecagonal | ⁠1/2⁠(17n$^2$ − 15n) | 1 | 19 | 54 | 106 | 175 | 261 | 364 | 484 | 621 | 775 | | A051871 |
| 20 | Icosagonal | ⁠1/2⁠(18n$^2$ − 16n) | 1 | 20 | 57 | 112 | 185 | 276 | 385 | 512 | 657 | 820 | | A051872 |
| 21 | Icosihenagonal | ⁠1/2⁠(19n$^2$ − 17n) | 1 | 21 | 60 | 118 | 195 | 291 | 406 | 540 | 693 | 865 | | A051873 |
| 22 | Icosidigonal | ⁠1/2⁠(20n$^2$ − 18n) | 1 | 22 | 63 | 124 | 205 | 306 | 427 | 568 | 729 | 910 | | A051874 |
| 23 | Icositrigonal | ⁠1/2⁠(21n$^2$ − 19n) | 1 | 23 | 66 | 130 | 215 | 321 | 448 | 596 | 765 | 955 | | A051875 |
| 24 | Icositetragonal | ⁠1/2⁠(22n$^2$ − 20n) | 1 | 24 | 69 | 136 | 225 | 336 | 469 | 624 | 801 | 1000 | | A051876 |
| 10000 | Myriagonal | ⁠1/2⁠(9998n$^2$ − 9996n) | 1 | 10000 | 29997 | 59992 | 99985 | 149976 | 209965 | 279952 | 359937 | 449920 | | A167149 |
The On-Line Encyclopedia of Integer Sequences eschews terms using Greek prefixes (e.g., "octagonal") in favor of terms using numerals (i.e., "8-gonal").
A property of this table can be expressed by the following identity (see A086270):
    $2\,P(s,n)=P(s+k,n)+P(s-k,n),$
with
    $k=0,1,2,3,...,s-3.$

## Combinations

Some numbers, such as 36 which is both square and triangular, fall into two polygonal sets. The problem of determining, given two such sets, all numbers that belong to both can be solved by reducing the problem to Pell's equation. The simplest example of this is the sequence of square triangular numbers.
The following table summarizes the set of s-gonal t-gonal numbers for small values of s and t.
    s t Sequence OEIS number 4 3 1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056, 1882672131025, 63955431761796, 2172602007770041, 73804512832419600, 2507180834294496361, 85170343853180456676, 2893284510173841030625, 98286503002057414584576, 3338847817559778254844961, ... A001110 5 3 1, 210, 40755, 7906276, 1533776805, 297544793910, 57722156241751, 11197800766105800, 2172315626468283465, … A014979 5 4 1, 9801, 94109401, 903638458801, 8676736387298001, 83314021887196947001, 799981229484128697805801, ... A036353 6 3 All hexagonal numbers are also triangular. A000384 6 4 1, 1225, 1413721, 1631432881, 1882672131025, 2172602007770041, 2507180834294496361, 2893284510173841030625, 3338847817559778254844961, 3853027488179473932250054441, ... A046177 6 5 1, 40755, 1533776805, … A046180 7 3 1, 55, 121771, 5720653, 12625478965, 593128762435, 1309034909945503, 61496776341083161, 135723357520344181225, 6376108764003055554511, 14072069153115290487843091, … A046194 7 4 1, 81, 5929, 2307361, 168662169, 12328771225, 4797839017609, 350709705290025, 25635978392186449, 9976444135331412025, … A036354 7 5 1, 4347, 16701685, 64167869935, … A048900 7 6 1, 121771, 12625478965, … A048903 8 3 1, 21, 11781, 203841, … A046183 8 4 1, 225, 43681, 8473921, 1643897025, 318907548961, 61866420601441, 12001766689130625, 2328280871270739841, 451674487259834398561, 87622522247536602581025, 16998317641534841066320321, … A036428 8 5 1, 176, 1575425, 234631320, … A046189 8 6 1, 11781, 113123361, … A046192 8 7 1, 297045, 69010153345, … A048906 9 3 1, 325, 82621, 20985481, … A048909 9 4 1, 9, 1089, 8281, 978121, 7436529, 878351769, 6677994961, 788758910641, 5996832038649, 708304623404049, 5385148492712041, 636056763057925561, ... A036411 9 5 1, 651, 180868051, … A048915 9 6 1, 325, 5330229625, … A048918 9 7 1, 26884, 542041975, … A048921 9 8 1, 631125, 286703855361, … A048924
In some cases, such as s = 10 and t = 4, there are no numbers in both sets other than 1.
The problem of finding numbers that belong to three polygonal sets is more difficult. A computer search for pentagonal square triangular numbers has yielded only the trivial value of 1, though a proof that there are no other such numbers has yet to be found.
The number 1225 is hecatonicositetragonal (s = 124), hexacontagonal (s = 60), icosienneagonal (s = 29), hexagonal, square, and triangular.