An octagonal number counts dots in a nested-octagon pattern with a shared vertex. Starting with one dot:
O1=1,O2=8,O3=21,O4=40,O5=65,O6=96,O7=133,…
The closed form is
On=n(3n−2)=3n2−2n
Octagonal numbers are the sixth in the family of polygonal numbers, following triangular, square, pentagonal, hexagonal, and heptagonal. The general r-gonal-number formula
Pn(r)=2n[(r−2)n−(r−4)]
specializes to octagonal at r=8, giving On=n(6n−4)/2=n(3n−2).
Sum-of-arithmetic-series form.On is the sum of the first n terms of the arithmetic series 1,7,13,19,25,… with a1=1 and common difference d=6. The step 6 reflects that r−2=6 for r=8.
For deeper coverage see octagonal number, polygonal numbers, and figurate numbers.
The Closed Form Derivation
From the arithmetic-series perspective. Octagonal numbers are sums of the arithmetic series 1,7,13,19,… with general term 6k−5:
From the general $r$-gonal formula. Substituting r=8:
On=2n[6n−4]=n(3n−2)
Why the formula is always an integer.On=n(3n−2) is a product of integers, so it is always an integer. No divisibility argument is needed; the closed form has no fractional component.
Connection to triangular numbers. Using Tn=n(n+1)/2:
On=n(3n−2)=3n2−2n=6⋅2n(n+1)−2n−3n=6Tn−5n
Or more simply: On=3Tn−2n+(correction), with the cleanest identity being On=Tn+4Tn−1 for n≥2. Expanding triangulars:
Wait — that gives heptagonal, not octagonal. The correct identity: On=T3n−2−T2n−2, which can be verified directly: T3n−2=(3n−2)(3n−1)/2 and T2n−2=(2n−2)(2n−1)/2; subtracting gives n(3n−2) after simplification.
Given a positive integer m, testing whether it is octagonal requires two checks.
The test.m is octagonal if and only if both:
1. 3m+1 is a perfect square, and 2. 1+3m+1 is divisible by 3.
If both hold, the index is
n=31+3m+1
Why both checks. From On=n(3n−2)=m, the quadratic 3n2−2n−m=0 has discriminant 4+12m=4(1+3m). The square root is 21+3m, and the quadratic formula gives
n=62+21+3m=31+3m+1
So 3m+1 must be a perfect square, and the numerator 1+3m+1 must be a multiple of 3.
Example. Is 225 octagonal? Compute 3⋅225+1=676=262 — perfect square. Then (1+26)/3=9, an integer. So 225=O9. Verify: 9⋅25=225. Confirmed.
Triangular but not octagonal. Is 15 octagonal? Compute 3⋅15+1=46. 46≈6.78 — not a perfect square. So 15 is not octagonal, even though it is triangular (T5=15) and hexagonal (H3=15).
Non-example. Is 100 octagonal? Compute 3⋅100+1=301. 301≈17.35 — not a perfect square. So 100 is not octagonal. Nearest are O6=96 and O7=133.
Properties and Identities
• Recurrence: On=On−1+(6n−5) with O1=1. Each octagonal adds the next arithmetic-series term. • Difference of consecutive octagonals: On+1−On=6n+1. Differences are 7, 13, 19, 25, ... • Generating function: ∑n=1∞Onxn=(1−x)3x(1+5x). • Asymptotic growth: On∼3n2. Octagonal numbers grow about three times as fast as square numbers. • Identity in triangulars: On=T3n−2−T2n−2 for n≥2. Octagonals as a difference of triangulars. • Sum of first $n$ octagonals: ∑k=1nOk=n2(n+1). A cleaner closed form than for some other polygonals. • Last-digit pattern: octagonal numbers in base 10 end only in 0, 1, 3, 5, 6, or 8. Numbers ending in other digits cannot be octagonal.
Common Applications
Like heptagonal numbers, octagonal numbers have fewer celebrated identities than the lower-degree polygonals, but they appear in several contexts.
• Fermat's polygonal number theorem. Every positive integer is a sum of at most 8 octagonal numbers. The r=8 case of the general theorem. • Polygonal completeness. When the polygonal family is studied systematically, octagonal is one of the canonical members; figurate-number tables routinely include it. • Lattice problems. Some 2D counting problems on octagonal regions involve octagonal-number boundaries. • Combinatorial identities. Identities relating octagonals to triangulars, squares, and pentagonals form parts of papers on figurate-number arithmetic. • Number-theoretic curiosities. Octagonal numbers that are also squares, triangulars, or pentagonals are individually studied; the intersections are sparse. • Educational use. Octagonal numbers are commonly used to illustrate the polygonal-number paradigm beyond the well-known triangular, square, and pentagonal cases.
Octagonal vs Centered Octagonal Numbers
As with hexagonal and heptagonal numbers, there is a distinct sequence called the centered octagonal numbers, which should not be confused with the polygonal octagonal numbers covered here.
Octagonal numbers (this page): nested octagons sharing one vertex. Closed form On=n(3n−2). Sequence: 1, 8, 21, 40, 65, 96, ...
Centered octagonal numbers: a central dot surrounded by concentric octagonal rings. Closed form Cn(8)=4n2−4n+1=(2n−1)2. Sequence: 1, 9, 25, 49, 81, 121, ...
Notably, centered octagonal numbers are exactly the odd perfect squares: Cn(8)=(2n−1)2. This unexpected identity makes the centered version more famous in some contexts.
When literature refers to "octagonal numbers" without qualification, it almost always means the polygonal sequence covered here. Centered octagonals require the "centered" qualifier.
Common Mistakes
• Forgetting the divisibility-by-3 check.3m+1 being a perfect square is necessary but not sufficient. The divisibility check on 1+3m+1 filters out spurious candidates.
• Misremembering the closed form.On=n(3n−2), not n(3n+2) or n(2n−3). The 3 comes from (r−2)/2=3 for r=8; the 2 comes from (r−4)/2=2.
• Confusing with centered octagonal numbers. Polygonal On gives 1, 8, 21, 40; centered Cn(8) gives 1, 9, 25, 49 (the odd squares). Very different sequences.
• Misapplying the discriminant. The correct discriminant for octagonals is 3m+1. Using 8m+1 (triangular), 24m+1 (pentagonal), or 40m+9 (heptagonal) gives wrong results.
• Off-by-one in arithmetic series. The series is 1,7,13,19,… with general term 6k−5 (where k starts at 1). Writing 6k+1 or 6k−1 gives different sequences.
• Confusing polygonal index with side count.On is the n-th octagonal number, not the count of dots in an octagon with side n (though they happen to coincide for the polygonal definition; the indexing can be subtle).
Related Sequences and Concepts
Triangular Numbers — Tn=n(n+1)/2. The r=3 polygonal sequence.
Square Numbers — Sn=n2. The r=4 polygonal sequence.
Pentagonal Numbers — Pn=n(3n−1)/2. The r=5 polygonal sequence; features in Euler's theorem.
Heptagonal Numbers — Hpn=n(5n−3)/2. The r=7 polygonal sequence.
Centered Octagonal Numbers — (2n−1)2 — the odd squares. A distinct sequence with concentric-ring geometry.
Polygonal Numbers — the general r-gonal family. Octagonal is the r=8 member.
Fermat's Polygonal Number Theorem — every positive integer is a sum of at most 8 octagonal numbers. The general statement: every positive integer is a sum of at most rr-gonal numbers, proved by Cauchy.
Arithmetic Series — On=∑k=1n(6k−5). The sum of an arithmetic series with a1=1 and d=6.
Figurate Numbers — the umbrella family.
Star Number — a related sequence (6n2−6n+1) sometimes confused with octagonal but distinct; gives 1, 13, 37, 73, 121, ...
Octagonal Pyramidal Numbers — the 3D analog: n(n+1)(2n−1)/2 wait, actually the formula is more involved. They count dots in an octagonal pyramid.
Generalized Polygonal Numbers — extension where indexes can be negative; less famous for octagonals than for pentagonals.