I am trying to find the formula for finding out if a number is heptagonal. I am also looking for the formula for finding out if a number is octagonal.
I already have the formula for finding out the nth heptagonal number and the nth octagonal number:
heptagonal: $\frac{n(5n - 3)}{2}$
octagonal: $n(3n-2n)$
For example, with these formulas the 20th heptagonal number is 970 and the 20th octagonal number is 1160. What I want to do is be able to do is plug in 1160 into my isOctagonal formula and get back 20th for octagonal. Or 970 and get back 20th for heptagonal.
I have managed to find these reverse formulas for triangular numbers, square numbers, pentagonal numbers, and hexagonal numbers. For example, the triangular one looks like this:$n = \frac{\sqrt{8x + 1} - 1}{2}$
Where x is the triangular candidate. If n is a natural number, n is the n-th triangular number.
I have been searching and searching for the heptagonal and octagonal formulas for a long time now and can't seem to find them.