Octagonal Pyramidal Number Calculator
Count a stack of octagonal layers with n times n plus one times two n minus one over two.
What it does
Octagonal pyramidal numbers count a stack built from octagonal layers. The nth term is the sum of the first n octagonal numbers. The sequence begins 1, 9, 30, 70, 135 and 231, and it follows a cubic rule with a single division by two.
The octagonal pyramid is the next member of the polygonal pyramid family after heptagons. As the number of sides rises, the coefficient in the formula changes, but the general cubic shape remains the same.
The closed form is n times n plus one times two n minus one, divided by two. This family is conventionally indexed from one, so the tool rejects zero rather than inventing a value for it.
This page evaluates the product with exact integer arithmetic and shows the previous term and ratio beside the answer. It gives counts only, not a drawing of the stack.
The layer limit is one hundred thousand, which keeps the printed value around sixteen digits.
How to use
- Enter the number of layers n from 1 to 100,000.
- Read the octagonal pyramidal number in the main result box.
- Check the previous term and growth beside it.
- The default n = 8 reproduces the worked example.
- Try n = 5 to confirm the value 231.
- Compare with heptagonal pyramidal numbers at the same count.
Formula
- n
- The number of octagonal layers, starting at one.
- P(n)
- The total number of points in the stack.
The formula comes from summing k times three k minus two for k from one to n. It simplifies to n times n plus one times two n minus one over two. The value at n = 1 is one, matching the first octagonal number.
Worked example
Example: eight layers
The page opens with n = 8.
- Compute n plus one: 9.
- Compute two n minus one: 16 - 1 = 15.
- Multiply the three factors: 8 x 9 x 15 = 1080.
- Divide by two: 1080 / 2 = 540.
- The tool reports 540, previous term 364, and growth 1.48x.
- Check the previous value: 7 x 8 x 13 / 2 = 364.
Reference table
| n | P(n) | Previous | Growth |
|---|---|---|---|
| 1 | 1 | n/a | n/a |
| 2 | 9 | 1 | 9.00x |
| 3 | 30 | 9 | 3.33x |
| 4 | 70 | 30 | 2.33x |
| 5 | 135 | 70 | 1.93x |
| 8 | 540 | 364 | 1.48x |
Limits
- The index starts at one, so zero is rejected.
- Layer counts above 100,000 are rejected to keep the output readable.
- The growth column is rounded to two decimals.
- The tool gives counts, not drawings of the stack.
Common mistakes
- Starting the index at zero and expecting a value there.
- Using two n minus two instead of two n minus one.
- Forgetting the division by two.
- Using the octagonal number rather than the pyramidal sum.
- Expecting quadratic growth from a cubic formula.
Try it yourself
Quick checks. Answers sit tucked under each question.
What is P(8)?
P(8) = 8 x 9 x 15 / 2 = 540.
What is P(5)?
P(5) = 5 x 6 x 9 / 2 = 135.
What is P(2)?
P(2) = 2 x 3 x 3 / 2 = 9.
Questions
How is this stack built?
Each layer is an ordinary octagonal number.
Why does indexing start at one?
That is the standard convention for this family, with the first value equal to one.
Is the division always exact?
Yes, and the tool checks it before returning a value.
What is the growth rate?
Cubic, from three linear factors.
Are values exact?
Yes. Integer arithmetic is used.
What layer count is accepted?
One through 100,000.
Sources
- OEIS A002414, octagonal pyramidal numbers
- Journal of Integer Sequences: Binomial Coefficients and Enumeration of Restricted Words