An octagonal number is a figurate number that gives the number of points in a certain octagonal arrangement. The octagonal number for n is given by the formula 3n2 − 2n, with n > 0. The first few octagonal numbers are
Solving the formula for the n-th octagonal number, for n gives
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.