Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Hexagonal Numbers Calculator

How to use Hexagonal Numbers Calculator
  1. 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
  2. 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
  3. 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
  4. 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
  5. In Lookup by index, type the position in Index n and click Get term. Learn more about lookups
  6. 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





Listing the First N Terms

DemoTen terms, thirty terms, the cap, one term
Step 0 of 4
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)/6N(N+1)(4N-1)/6. Under the cards every term is laid out as a tile with its index above its value, so H1=1H_1 = 1 to HNH_N can be read in order.

The box accepts 11 to 200200: 1010 gives H10=190H_{10} = 190 with the sum 715715, 3030 gives H30=1,770H_{30} = 1,770 with the sum 18,44518,445, and 300300 is capped at 200200 terms, ending at H200=79,800H_{200} = 79,800 with the sum 5,353,3005,353,300; a single term gives H1=1H_1 = 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 NN. 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 11. Type the From index and the To index and click List range or press Enter. The cards give the Count b−a+1b - a + 1, the Smallest term HaH_a and the Largest term HbH_b, and the tiles below list every term in between with its index. The tab opens with 55 to 1515, 11 terms from H5=45H_{5} = 45 to H15=435H_{15} = 435; indexes 1010 to 2020 give 11 terms from 190190 to 780780.

Both boxes must hold positive integers, the first no larger than the second, and the range may hold at most 200200 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 190190, which is H10H_{10}; a red box with a cross answers no, as for 100100, and the walkthrough on the right then shows the two nearest hexagonal numbers, H7=91H_{7} = 91 and H8=120H_{8} = 120. A large value is handled the same way: 4,9504,950 is H50H_{50}.

The box takes positive integers only; 00, 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+18m + 1 is a perfect square whose root is 33 more than a multiple of 44; if it is, the index is (8m+1+1)/4(\sqrt{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 nn and Value gives HnH_n with its index as a subscript. The tab opens with n=25n = 25, which gives H25=1,225H_{25} = 1,225; n=100n = 100 gives 19,90019,900 and n=1000n = 1000 gives 1,999,0001,999,000. The box takes positive integers only; 00 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)H_n = 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 nn 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,…H_1 = 1, \quad H_2 = 6, \quad H_3 = 15, \quad H_4 = 28, \quad H_5 = 45, \quad H_6 = 66, \quad \ldots


The closed form is

Hn=n(2n−1)=2n2−nH_n = n(2n - 1) = 2n^2 - n


Key identity. Every hexagonal number is also a triangular number:

Hn=T2n−1H_n = T_{2n - 1}


This means hexagonal numbers are exactly the odd-indexed triangular numbers. H1=T1H_1 = T_1, H2=T3H_2 = T_3, H3=T5H_3 = T_5, H4=T7H_4 = T_7, and so on. The hexagonal numbers form a subsequence of triangular numbers.

Sum-of-arithmetic-series form. Hn=1+5+9+⋯+(4n−3)H_n = 1 + 5 + 9 + \cdots + (4n - 3), the sum of the first nn terms of the arithmetic series with a1=1a_1 = 1 and common difference d=4d = 4.

For deeper coverage see hexagonal number, polygonal numbers, and figurate numbers.

Figurate numbers are introduced through their simplest case in triangular numbers; the general idea of an explicit formula is explicit and recursive definitions.

The triangular numbers every hexagonal number equals are defined in definition and derived in derivation of the closed form.

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)H_n = \sum_{k=1}^{n}(4k - 3):

Hn=4⋅n(n+1)2−3n=2n2+2n−3n=2n2−n=n(2n−1)H_n = 4 \cdot \frac{n(n+1)}{2} - 3n = 2n^2 + 2n - 3n = 2n^2 - n = n(2n - 1)


The triangular identity. Substituting Tk=k(k+1)/2T_k = k(k+1)/2 with k=2n−1k = 2n - 1:

T2n−1=(2n−1)(2n)2=n(2n−1)=HnT_{2n - 1} = \frac{(2n - 1)(2n)}{2} = n(2n - 1) = H_n


This identity says: stretch a triangular pattern by aligning every other row, and you get a hexagonal pattern with nn "layers."

Why hexagonal numbers are exactly the odd-indexed triangulars. Triangulars with even index T2nT_{2n} give n(2n+1)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=T1H_1 = 1 = T_1
• H2=6=T3H_2 = 6 = T_3
• H3=15=T5H_3 = 15 = T_5
• H4=28=T7H_4 = 28 = T_7
• H5=45=T9H_5 = 45 = T_9

The Membership Test

Given a positive integer mm, deciding whether it is hexagonal requires two checks.

The test. mm is hexagonal if and only if both:

1. 8m+18m + 1 is a perfect square, and
2. 1+8m+11 + \sqrt{8m + 1} is divisible by 4.

If both hold, the index is

n=1+8m+14n = \frac{1 + \sqrt{8m + 1}}{4}


Why both checks. Note that condition 1 (8m+18m + 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+11 + \sqrt{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=3928 \cdot 190 + 1 = 1521 = 39^2 — a perfect square. Then (1+39)/4=10(1 + 39)/4 = 10, an integer. So 190=H10190 = H_{10}. Verify: 10⋅19=19010 \cdot 19 = 190. Confirmed.

Triangular but not hexagonal. Is 10 hexagonal? Compute 8⋅10+1=81=928 \cdot 10 + 1 = 81 = 9^2 — perfect square, so 10 is triangular (10=T410 = T_4). But (1+9)/4=10/4=2.5(1 + 9)/4 = 10/4 = 2.5 — not an integer. So 10 is not hexagonal. Indeed T4T_4 has even index 4, not odd.

Non-example. Is 100 hexagonal? Compute 8⋅100+1=8018 \cdot 100 + 1 = 801. Then 801≈28.3\sqrt{801} \approx 28.3 — not a perfect square. So 100 is not triangular, hence not hexagonal.

Properties and Identities

• Recurrence: Hn=Hn−1+(4n−3)H_n = H_{n-1} + (4n - 3) with H1=1H_1 = 1. Each hexagonal adds the next arithmetic-series term.
• Hexagonal-triangular: Hn=T2n−1H_n = T_{2n-1}. Hexagonal numbers are exactly the odd-indexed triangulars.
• Sum of two consecutive triangulars: T2n−1+T2n−2T_{2n-1} + T_{2n-2} does not equal HnH_n in general; the relation between hexagonal and consecutive triangulars is just Hn=T2n−1H_n = T_{2n-1}.
• Difference of consecutive hexagonals: Hn+1−Hn=4n+1H_{n+1} - H_n = 4n + 1. The differences are 5, 9, 13, 17, ... — the arithmetic series.
• Generating function: ∑n=1∞Hnxn=x(1+3x)(1−x)3\sum_{n=1}^{\infty} H_n x^n = \frac{x(1 + 3x)}{(1 - x)^3}.
• Asymptotic growth: Hn∼2n2H_n \sim 2n^2. 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 NN triangular numbers, about N/2N/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)H_n = 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)+1C_n = 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 HnH_n: shares a single corner vertex with the previous hexagon; less symmetric pattern.
• Centered hexagonal CnC_n: 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=(2n2)/2H_n = \binom{2n}{2}/2 gives an unusual binomial-coefficient identity (this is Hn=T2n−1H_n = T_{2n-1} in disguise via Tk=(k+12)T_k = \binom{k+1}{2}).
• 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+18m + 1 being a perfect square means mm is triangular, but not necessarily hexagonal. The divisibility-by-4 condition on 1+8m+11 + \sqrt{8m + 1} filters to odd-indexed triangulars. Example: 10=T410 = T_4 is triangular but not hexagonal; (1+9)/4=2.5(1 + 9)/4 = 2.5.

• Misremembering the closed form. Hn=n(2n−1)H_n = n(2n - 1), not n(2n+1)n(2n + 1) or 2n(n−1)2n(n - 1). The minus sign matters.

• Confusing the hexagonal-triangular relation. Hn=T2n−1H_n = T_{2n - 1}, not T2nT_{2n} or Tn+1T_{n+1}. The index in the triangular sequence is odd: 2n−12n - 1.

• Confusing with hexagonal pyramidal numbers. The 3D analog HPn=n(n+1)(4n−1)/6\mathrm{HP}_n = 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.

Index conventions and the two ways of defining a sequence are explained in definition and notation and explicit and recursive definitions.