Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Hexagonal Numbers Calculator






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(2n1)=2n2nH_n = n(2n - 1) = 2n^2 - n


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

Hn=T2n1H_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++(4n3)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.

The Closed Form and the Triangular Connection

Closed form derivation. From the arithmetic-series perspective, Hn=k=1n(4k3)H_n = \sum_{k=1}^{n}(4k - 3):

Hn=4n(n+1)23n=2n2+2n3n=2n2n=n(2n1)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=2n1k = 2n - 1:

T2n1=(2n1)(2n)2=n(2n1)=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 8190+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: 1019=19010 \cdot 19 = 190. Confirmed.

Triangular but not hexagonal. Is 10 hexagonal? Compute 810+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 8100+1=8018 \cdot 100 + 1 = 801. Then 80128.3\sqrt{801} \approx 28.3 — not a perfect square. So 100 is not triangular, hence not hexagonal.

Properties and Identities

Recurrence: Hn=Hn1+(4n3)H_n = H_{n-1} + (4n - 3) with H1=1H_1 = 1. Each hexagonal adds the next arithmetic-series term.
Hexagonal-triangular: Hn=T2n1H_n = T_{2n-1}. Hexagonal numbers are exactly the odd-indexed triangulars.
Sum of two consecutive triangulars: T2n1+T2n2T_{2n-1} + T_{2n-2} does not equal HnH_n in general; the relation between hexagonal and consecutive triangulars is just Hn=T2n1H_n = T_{2n-1}.
Difference of consecutive hexagonals: Hn+1Hn=4n+1H_{n+1} - H_n = 4n + 1. The differences are 5, 9, 13, 17, ... — the arithmetic series.
Generating function: n=1Hnxn=x(1+3x)(1x)3\sum_{n=1}^{\infty} H_n x^n = \frac{x(1 + 3x)}{(1 - x)^3}.
Asymptotic growth: Hn2n2H_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(2n1)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(n1)+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=T2n1H_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.

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(2n1)H_n = n(2n - 1), not n(2n+1)n(2n + 1) or 2n(n1)2n(n - 1). The minus sign matters.

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

Confusing with hexagonal pyramidal numbers. The 3D analog HPn=n(n+1)(4n1)/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.

Related Sequences and Concepts

Triangular NumbersTn=n(n+1)/2T_n = n(n+1)/2. Hexagonal numbers are the odd-indexed subsequence: Hn=T2n1H_n = T_{2n-1}.

Square NumbersSn=n2S_n = n^2. Hexagonal numbers grow about twice as fast.

Pentagonal NumbersPn=n(3n1)/2P_n = n(3n-1)/2. The previous polygonal-number sequence in the family.

Heptagonal NumbersHpn=n(5n3)/2\mathrm{Hp}_n = n(5n-3)/2. The next polygonal-number sequence.

Octagonal NumbersOn=n(3n2)O_n = n(3n-2). Two steps further in the polygonal family.

Centered Hexagonal NumbersCn=3n(n1)+1C_n = 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=6r = 6 case in Pn(r)=n[(r2)n(r4)]/2P_n^{(r)} = n[(r-2)n - (r-4)]/2.

Hexagonal Pyramidal Numbers — the 3D analog: HPn=n(n+1)(4n1)/6\mathrm{HP}_n = 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 rr-gonal numbers. Conjectured by Fermat, proved by Lagrange (squares), Gauss (triangulars), and Cauchy (general).

Arithmetic SeriesHnH_n is the sum of the first nn terms of the arithmetic series 1,5,9,13,1, 5, 9, 13, \ldots with d=4d = 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.