Mathwords logoMathwords

Heptagonal Number — Definition, Formula & Example

A heptagonal number is a number of dots that can be arranged as a seven-sided figure, where each new layer adds a bigger heptagon around a shared corner. The sequence starts 1, 7, 18, 34, 55, 81, ...

For a positive integer nn, the nnth heptagonal number is Hn=n(5n−3)2H_n = \tfrac{n(5n-3)}{2}. It is the s=7s = 7 case of the polygonal number formula P(s,n)=(s−2)n2−(s−4)n2P(s,n) = \tfrac{(s-2)n^2 - (s-4)n}{2}. Consecutive terms differ by Hn−Hn−1=5n−4H_n - H_{n-1} = 5n - 4 for n≥2n \ge 2, so the sequence has a constant second difference of 5.

Key Formula

Hn=n(5n−3)2=5n2−3n2H_n = \frac{n(5n-3)}{2} = \frac{5n^2 - 3n}{2}
Where:
  • HnH_n = the nth heptagonal number
  • nn = the position in the sequence (n = 1, 2, 3, ...), also the number of dots along each side of the outer heptagon

Worked Example

Problem: Is 148 a heptagonal number? If it is, find its position n in the sequence.
Step 1: Set the formula equal to 148 and clear the fraction. This gives a quadratic equation in nn.
n(5n−3)2=148  ⟹  5n2−3n−296=0\frac{n(5n-3)}{2} = 148 \;\Longrightarrow\; 5n^2 - 3n - 296 = 0
Step 2: Compute the discriminant. The number 148 can only be heptagonal if the discriminant is a perfect square.
(−3)2−4(5)(−296)=9+5920=5929=772(-3)^2 - 4(5)(-296) = 9 + 5920 = 5929 = 77^2
Step 3: Apply the quadratic formula. Reject the negative root, because nn must be a positive integer.
n=3±7710  ⟹  n=8 or n=−7.4n = \frac{3 \pm 77}{10} \;\Longrightarrow\; n = 8 \text{ or } n = -7.4
Step 4: Check the result by substituting n=8n = 8 back into the formula.
H8=8(5⋅8−3)2=8⋅372=148  ✓H_8 = \frac{8(5 \cdot 8 - 3)}{2} = \frac{8 \cdot 37}{2} = 148 \; \checkmark
Answer: Yes. 148 is the 8th heptagonal number, so H8=148H_8 = 148.

Why It Matters

The Fermat polygonal number theorem, proved by Cauchy in 1813, states that every positive integer is a sum of at most seven heptagonal numbers. In Algebra 2, the sequence is a clean example of a quadratic sequence: its second differences are always 5. Competition problems often ask you to test membership the way the worked example does.

Common Mistakes

Mistake: Writing the formula as n(5n+3)2\tfrac{n(5n+3)}{2}, which gives 4, 13, 27, ... instead of 1, 7, 18, ...
Correction: The sign inside is minus: Hn=n(5n−3)2H_n = \tfrac{n(5n-3)}{2}. Check it quickly with H1H_1. Every polygonal sequence must start at 1.

Related Terms

  • Modular Arithmetic — Working mod 2 shows the parity pattern odd, odd, even, even repeating
  • Polygonal Number — Parent family of figurate numbers including heptagonal ones
  • Heptagon — Seven-sided polygon that the dot pattern is built on
  • Hexagonal Number — Sibling polygonal number using six-sided figures instead