Octagonal Number Calculator

Find the octagonal figurate number at an index from n times three n minus two, with growth shown.

Math and PercentUpdated 2026-11-182 min read
Octagonal Number Calculator
A whole number from 0 to 100,000.
Octagonal number
...
Previous term...
Growth from previous...

What it does

Octagonal numbers are figurate numbers associated with an eight sided polygon. The nth term counts dots in a nested octagonal arrangement. The first few values are 0, 1, 8, 21, 40 and 65, and they follow a simple quadratic rule with no division.

The octagonal case is one of the polygonal number families studied since antiquity. In the general formula for s sides, setting s equal to eight gives n times three n minus two. The absence of a denominator makes this family especially easy to compute by hand.

These numbers grow like three times n squared, so they overtake heptagonal numbers for the same index. As with all quadratic sequences, the ratio of consecutive terms approaches one while the absolute gap grows steadily.

This page evaluates the formula with exact integer arithmetic and shows the previous term and ratio beside the answer. It also notes that octagonal numbers are sometimes called star numbers in older references.

The index limit is one hundred thousand, at which point the result has about eleven digits and is printed in full.

How to use

  1. Enter an index n from 0 to 100,000.
  2. Read the octagonal number in the main result box.
  3. Check the previous term and growth beside it.
  4. The default index 6 reproduces the worked example.
  5. Try n = 5 to confirm the value 65.
  6. Compare with heptagonal numbers at the same index.

Formula

O(n) = n x (3n - 2)
n
The index, or number of layers, of the figure.
O(n)
The octagonal number at that index.

The general polygonal formula gives n times (s minus two) times n minus (s minus four), divided by two. With s equal to eight this simplifies to n times three n minus two, so no division is needed. The sequence starts at index zero with the value zero.

Worked example

Example: index 6

The page opens with n = 6.

  1. Write the formula: O(6) = 6 x (3 x 6 - 2).
  2. Compute three times six: 18.
  3. Subtract two: 18 - 2 = 16.
  4. Multiply by six: 6 x 16 = 96.
  5. The tool reports 96, previous term 65, and growth 1.48x.
  6. Check the previous term: 5 x (15 - 2) = 65.

Reference table

Octagonal numbers at small indices
nO(n)PreviousGrowth
00n/an/a
110n/a
2818.00x
440211.90x
565401.63x
696651.48x

Limits

  • Indices above 100,000 are rejected to keep the output readable.
  • The growth column is rounded to two decimals.
  • The tool gives counts, not polygon drawings.
  • Only the standard offset beginning at zero is used.

Common mistakes

  • Using three n plus two instead of three n minus two.
  • Applying a division by two that this formula does not need.
  • Confusing octagonal numbers with octahedral numbers, which count spheres in a solid.
  • Expecting the ratio to grow rather than approach one.
  • Starting the sequence at one without adjusting the index.

Try it yourself

Quick checks. Answers sit tucked under each question.

What is O(6)?

O(6) = 6 x 16 = 96.

What is O(5)?

O(5) = 5 x 13 = 65.

What is O(2)?

O(2) = 2 x 4 = 8.

Questions

What is an octagonal number?

A figurate number whose dots form nested eight sided polygons.

Why is there no division?

Substituting eight into the general polygonal formula cancels the denominator.

Are these the same as star numbers?

Some references use that name, but the standard OEIS star numbers follow a different rule.

How fast do they grow?

Like three times n squared, faster than heptagonal numbers.

Are the values exact?

Yes. Integer multiplication only is used.

What index range is accepted?

Zero through 100,000.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.