Pick a mode with the four tabs across the top of the card: List first N, List a – b, Test a number or Lookup by index; the ? beside each tab describes it. Learn more about the modes
In List first N, type how many terms to show in Show first and click Update; the cards give the count, the largest term and the sum, and the tiles list every term. Learn more about listing terms
In List a – b, type the From index and the To index and click List range; a red box explains a bad range. Learn more about ranges
In Test a number, type a positive integer in Test number and click Check; a green box names the index, a red box says it is not a hexagonal number. Learn more about the test
The panel on the right explains the current mode and walks through the arithmetic with your own numbers; it changes with every tab and click. Learn more about the panel
The explorer opens on the List first N tab, one of four tabs across the top of the card; the small ? beside each tab shows what the mode does. Type how many terms you want in the Show first box and click Update or press Enter. Three cards answer at once: Showing gives the count, Largest the last term with its index, and Sum the total of the listed terms, which for hexagonal numbers is N(N+1)(4N−1)/6. Under the cards every term is laid out as a tile with its index above its value, so H1=1 to HN can be read in order.
The box accepts 1 to 200: 10 gives H10=190 with the sum 715, 30 gives H30=1,770 with the sum 18,445, and 300 is capped at 200 terms, ending at H200=79,800 with the sum 5,353,300; a single term gives H1=1. Large values are printed with thousands separators. A count of 0, a decimal or an empty box is refused with "Enter a positive integer." There is no Reset button: type a new count and click Update again. The panel on the right, List first N, states the rule the tiles come from, and its walkthrough repeats the last term and the sum with your own N. What the terms are is explained in what is a hexagonal number.
Listing a Range of Indexes
DemoThe range tab, a new range, two bad ranges
Step 0 of 4
Click the List a – b tab to list the terms between two positions instead of starting from 1. Type the From index and the To index and click List range or press Enter. The cards give the Countb−a+1, the Smallest term Ha and the Largest term Hb, and the tiles below list every term in between with its index. The tab opens with 5 to 15, 11 terms from H5=45 to H15=435; indexes 10 to 20 give 11 terms from 190 to 780.
Both boxes must hold positive integers, the first no larger than the second, and the range may hold at most 200 terms; otherwise a red box explains: "Enter two positive integer indexes", "From-index must be less than or equal to to-index", or "Range too wide — cap is 200 terms". The panel on the right, List a – b, explains the mode, and its walkthrough names the smallest and largest term of your range. The rule each tile uses is explained in the closed form and the triangular connection.
Testing a Number
DemoThe test tab, a non-member, a member, 0
Step 0 of 4
Click the Test a number tab to ask whether a given positive integer is a hexagonal number. Type it in the Test number box and click Check or press Enter. A green box with a tick answers yes and names the index, as for the opening value 190, which is H10; a red box with a cross answers no, as for 100, and the walkthrough on the right then shows the two nearest hexagonal numbers, H7=91 and H8=120. A large value is handled the same way: 4,950 is H50.
The box takes positive integers only; 0, a negative number or a decimal is refused with "Enter a positive integer". The test behind the answer is exact: the explorer checks whether 8m+1 is a perfect square whose root is 3 more than a multiple of 4; if it is, the index is (8m+1+1)/4, otherwise the two nearest hexagonal numbers are shown, so no list has to be searched. The panel on the right, Test a number, states this rule, and its walkthrough carries out the arithmetic for your number. The rule itself is explained in the membership test.
Looking Up a Term by Index
DemoThe lookup tab, two indexes, n = 0
Step 0 of 4
Click the Lookup by index tab to compute one term directly. Type the position in the Index n box and click Get term or press Enter. Two cards answer: Index repeats n and Value gives Hn with its index as a subscript. The tab opens with n=25, which gives H25=1,225; n=100 gives 19,900 and n=1000 gives 1,999,000. The box takes positive integers only; 0 is refused with "Enter a positive integer index".
The panel on the right has two parts in every mode. How it works names the rule the mode uses, here Hn=n(2n−1), and links to the section of this page that explains it; Walkthrough applies the rule to the numbers you typed, so for the lookup it shows the arithmetic with your n filled in. Both change as soon as you switch tabs or click a button. The rule and where it comes from are in the closed form and the triangular connection.
What is a Hexagonal Number?
A hexagonal number counts dots in a nested-hexagon pattern with a shared vertex. Starting with one dot:
H1=1,H2=6,H3=15,H4=28,H5=45,H6=66,…
The closed form is
Hn=n(2n−1)=2n2−n
Key identity. Every hexagonal number is also a triangular number:
Hn=T2n−1
This means hexagonal numbers are exactly the odd-indexed triangular numbers. H1=T1, H2=T3, H3=T5, H4=T7, and so on. The hexagonal numbers form a subsequence of triangular numbers.
Sum-of-arithmetic-series form.Hn=1+5+9+⋯+(4n−3), the sum of the first n terms of the arithmetic series with a1=1 and common difference d=4.
For deeper coverage see hexagonal number, polygonal numbers, and figurate numbers.
The test it generalises is the triangular one in properties.
The triangular identities these build on are in properties.
Both families count dots in a hexagon; the simplest figurate family is triangular numbers.
The Closed Form and the Triangular Connection
Closed form derivation. From the arithmetic-series perspective, Hn=∑k=1n(4k−3):
Hn=4⋅2n(n+1)−3n=2n2+2n−3n=2n2−n=n(2n−1)
The triangular identity. Substituting Tk=k(k+1)/2 with k=2n−1:
T2n−1=2(2n−1)(2n)=n(2n−1)=Hn
This identity says: stretch a triangular pattern by aligning every other row, and you get a hexagonal pattern with n "layers."
Why hexagonal numbers are exactly the odd-indexed triangulars. Triangulars with even index T2n give n(2n+1), not the hexagonal formula. So even-indexed triangulars (3, 10, 21, 36, ...) are not hexagonal; only odd-indexed ones are.
Examples of the identity. • H1=1=T1 • H2=6=T3 • H3=15=T5 • H4=28=T7 • H5=45=T9
The Membership Test
Given a positive integer m, deciding whether it is hexagonal requires two checks.
The test.m is hexagonal if and only if both:
1. 8m+1 is a perfect square, and 2. 1+8m+1 is divisible by 4.
If both hold, the index is
n=41+8m+1
Why both checks. Note that condition 1 (8m+1 is a perfect square) is the triangular test. So every hexagonal number is triangular (as expected). But not every triangular number is hexagonal — only those where 1+8m+1 is also divisible by 4. The divisibility check is what distinguishes odd-indexed triangulars (which are hexagonal) from even-indexed triangulars (which are not).
Example. Is 190 hexagonal? Compute 8⋅190+1=1521=392 — a perfect square. Then (1+39)/4=10, an integer. So 190=H10. Verify: 10⋅19=190. Confirmed.
Triangular but not hexagonal. Is 10 hexagonal? Compute 8⋅10+1=81=92 — perfect square, so 10 is triangular (10=T4). But (1+9)/4=10/4=2.5 — not an integer. So 10 is not hexagonal. Indeed T4 has even index 4, not odd.
Non-example. Is 100 hexagonal? Compute 8⋅100+1=801. Then 801≈28.3 — not a perfect square. So 100 is not triangular, hence not hexagonal.
Properties and Identities
• Recurrence: Hn=Hn−1+(4n−3) with H1=1. Each hexagonal adds the next arithmetic-series term. • Hexagonal-triangular: Hn=T2n−1. Hexagonal numbers are exactly the odd-indexed triangulars. • Sum of two consecutive triangulars: T2n−1+T2n−2 does not equal Hn in general; the relation between hexagonal and consecutive triangulars is just Hn=T2n−1. • Difference of consecutive hexagonals: Hn+1−Hn=4n+1. The differences are 5, 9, 13, 17, ... — the arithmetic series. • Generating function: ∑n=1∞Hnxn=(1−x)3x(1+3x). • Asymptotic growth: Hn∼2n2. Hexagonal numbers grow about twice as fast as square numbers. • Last-digit pattern: hexagonal numbers in base 10 end only in 0, 1, 5, 6, 8, or rarely with other digits depending on the index parity. • Density within triangulars: among the first N triangular numbers, about N/2 are hexagonal (the odd-indexed ones).
Hexagonal Numbers vs Centered Hexagonal Numbers
An important distinction: "hexagonal numbers" in the traditional sense (described here) differ from centered hexagonal numbers.
Hexagonal numbers (this explorer): nested hexagons sharing one vertex. Closed form Hn=n(2n−1). Sequence: 1, 6, 15, 28, 45, 66, ...
Centered hexagonal numbers: hexagons with a center dot, surrounded by concentric hexagonal layers. Closed form Cn=3n(n−1)+1. Sequence: 1, 7, 19, 37, 61, 91, ... These count atoms in 2D close-packed structures.
The two sequences are sometimes confused but represent different geometric patterns:
• Hexagonal Hn: shares a single corner vertex with the previous hexagon; less symmetric pattern. • Centered hexagonal Cn: builds concentric rings around a central point; the canonical pattern for close-packed circles or atoms.
This page covers the traditional polygonal hexagonal numbers following the polygonal family. For centered hexagonal numbers, see a separate dedicated tool.
Common Applications
• Triangular subsequence. Whenever odd-indexed triangulars are needed (in identities, partial sums, or combinatorial problems), hexagonal numbers are the direct shortcut. • Hexagonal patterns in nature. Although the most famous hexagonal patterns (honeycomb, snowflakes) align more with centered hexagonals or hexagonal lattices, the polygonal hexagonal sequence still appears in counting problems on hexagonal regions. • Combinatorics.Hn=(22n)/2 gives an unusual binomial-coefficient identity (this is Hn=T2n−1 in disguise via Tk=(2k+1)). • Partition theory. Hexagonal numbers appear in some partition-counting identities, though pentagonal numbers play the more prominent role. • Recreational mathematics. Hexagonal numbers are studied alongside triangular and square numbers in figurate-number puzzles and problems. • Number theory. Many results about polygonal numbers (Fermat's polygonal number theorem, for instance) include hexagonal as a special case.
The counting ideas behind these uses start from properties.
Common Mistakes
• Confusing hexagonal with centered hexagonal numbers. The two sequences look superficially similar (both start with 1) but diverge: hexagonal gives 1, 6, 15, 28; centered hexagonal gives 1, 7, 19, 37. Always check which definition is intended.
• Forgetting the divisibility-by-4 check.8m+1 being a perfect square means m is triangular, but not necessarily hexagonal. The divisibility-by-4 condition on 1+8m+1 filters to odd-indexed triangulars. Example: 10=T4 is triangular but not hexagonal; (1+9)/4=2.5.
• Misremembering the closed form.Hn=n(2n−1), not n(2n+1) or 2n(n−1). The minus sign matters.
• Confusing the hexagonal-triangular relation.Hn=T2n−1, not T2n or Tn+1. The index in the triangular sequence is odd: 2n−1.
• Confusing with hexagonal pyramidal numbers. The 3D analog HPn=n(n+1)(4n−1)/6 counts dots in a hexagonal pyramid, not a flat hexagon. Different sequence, different formula.
• Treating the membership test as equivalent to the triangular test. Triangular membership uses one condition; hexagonal requires two. Skipping the divisibility check misclassifies even-indexed triangulars as hexagonal.
Triangular Numbers — Tn=n(n+1)/2. Hexagonal numbers are the odd-indexed subsequence: Hn=T2n−1.
Square Numbers — Sn=n2. Hexagonal numbers grow about twice as fast.
Pentagonal Numbers — Pn=n(3n−1)/2. The previous polygonal-number sequence in the family.
Heptagonal Numbers — Hpn=n(5n−3)/2. The next polygonal-number sequence.
Octagonal Numbers — On=n(3n−2). Two steps further in the polygonal family.
Centered Hexagonal Numbers — Cn=3n(n−1)+1. A different but related sequence; counts close-packed circles in concentric hexagonal rings.
Polygonal Numbers — the general family. Hexagonal is the r=6 case in Pn(r)=n[(r−2)n−(r−4)]/2.
Hexagonal Pyramidal Numbers — the 3D analog: HPn=n(n+1)(4n−1)/6. Counts dots in a hexagonal pyramid.
Fermat Polygonal Number Theorem — every positive integer is a sum of at most rr-gonal numbers. Conjectured by Fermat, proved by Lagrange (squares), Gauss (triangulars), and Cauchy (general).
Arithmetic Series — Hn is the sum of the first n terms of the arithmetic series 1,5,9,13,… with d=4.
Figurate Numbers — the umbrella family. Hexagonal numbers are 2D, 6-sided.
Hexagonal Lattice — the regular lattice of hexagons; relevant to centered hexagonals more than to polygonal hexagonals, but worth knowing in context.