Octahedral Number Calculator
Count spheres in an octahedral stack from n times two n squared plus one, divided by three.
What it does
An octahedral number counts the spheres in a complete octahedral arrangement, with one sphere at the centre and successive shells around it. The sequence begins 0, 1, 6, 19, 44 and 85. It is the three dimensional counterpart of the centred square numbers.
The octahedron has eight faces, which gives the family its name. Counting the shells leads to the formula n times two n squared plus one, divided by three. The division is always exact for whole n, and the tool checks this before returning a value.
Because the formula is cubic, these numbers grow much faster than polygonal numbers. Doubling the side length multiplies the count by roughly eight. The ratio of consecutive terms tends to one only slowly compared with a quadratic family.
This page evaluates the formula with exact integer arithmetic and reports the previous count and ratio beside it. It does not draw the solid, only counts the spheres it would contain.
The side limit is one hundred thousand, which produces a value with about sixteen digits, printed in full.
How to use
- Enter a side length n from 0 to 100,000.
- Read the octahedral count in the main result box.
- Check the previous count and growth beside it.
- The default side 5 reproduces the worked example.
- Try n = 4 to confirm the value 44.
- Compare with tetrahedral numbers to see a different solid family.
Formula
- n
- The side length of the octahedral stack.
- O(n)
- The number of spheres in the stack.
The octahedral number is also the sum of two consecutive square pyramidal numbers. The numerator n times two n squared plus one is always divisible by three, so the result is an integer for every n. The value at n = 0 is zero and at n = 1 is one.
Worked example
Example: side 5
The page opens with n = 5.
- Compute n squared: 5 x 5 = 25.
- Double it: 50, then add one to get 51.
- Multiply by n: 5 x 51 = 255.
- Divide by three: 255 / 3 = 85.
- The tool reports 85, previous count 44, and growth 1.93x.
- Check the previous value: 4 x (32 + 1) / 3 = 44.
Reference table
| n | O(n) | Previous | Growth |
|---|---|---|---|
| 0 | 0 | n/a | n/a |
| 1 | 1 | 0 | n/a |
| 2 | 6 | 1 | 6.00x |
| 3 | 19 | 6 | 3.17x |
| 4 | 44 | 19 | 2.32x |
| 5 | 85 | 44 | 1.93x |
Limits
- Inputs above 100,000 are rejected to keep the printed value manageable.
- The growth column is rounded to two decimals.
- The tool counts spheres but does not draw the arrangement.
- Only the standard octahedral family starting at zero is used.
Common mistakes
- Using octahedral numbers where octagonal numbers are meant.
- Forgetting to divide by three.
- Treating the growth as quadratic when it is cubic.
- Rounding the division instead of checking exactness.
- Counting only one pyramid instead of the full octahedron.
Try it yourself
Quick checks. Answers sit tucked under each question.
What is the octahedral number for side 5?
5 x 51 / 3 = 85.
What is the value for side 4?
4 x 33 / 3 = 44.
How does the count scale when the side doubles?
Since the formula is cubic, the count grows by roughly a factor of eight.
Questions
What does this number count?
The spheres in a complete stack shaped like an octahedron.
Is the division always exact?
Yes, the numerator is divisible by three for every whole n, and the tool verifies it.
How is this related to square pyramidal numbers?
An octahedral number is the sum of two consecutive square pyramidal numbers.
How fast do they grow?
Cubically, much faster than polygonal numbers.
Are values exact?
Yes, arbitrary precision integer arithmetic is used.
What side lengths are accepted?
Whole numbers from zero through 100,000.