An **octagonal number** is a figurate number that represents an octagon. The octagonal number for *n* is given by the formula 3*n*^{2} - 2*n*, with *n* > 0. The first few octagonal numbers are:

1, 8, 21, 40, 65, 96, 133, 176, 225, 280, 341, 408, 481, 560, 645, 736, 833, 936 OEIS A{{{1}}}

Octagonal numbers can be formed by placing triangular numbers on the four sides of a square. To put it algebraically, the *n*-th octagonal number is

- $ x_n=n^2 + 4\sum_{k = 1}^{n - 1} k = 3n^2-2n. $

The octagonal number for *n* can also be calculated by adding the square of *n* to twice the (*n - 1*)th pronic number.

Octagonal numbers consistently alternate parity.

Octagonal numbers are occasionally referred to as "star numbers," though that term is more commonly used to refer to centered dodecagonal numbers.^{[1]}

## Test for octagonal numbersEdit

Solving the formula for the *n*-th octagonal number, $ x_n, $ for *n* gives

- $ n= \frac{\sqrt{3x_n+1}+1}{3}. $

An arbitrary number *x* can be checked for octagonality by putting it in this equation. If *n* is an integer, then *x* is the *n*-th octagonal number. If *n* is not an integer, then *x* is not octagonal.