Nonagonal numbers are figurate numbers that represent the number of dots in a pattern of evenly spaced dots forming a regular nonagon.
The formula to find the nth nonagonal number is: n * (7n - 5) / 2
Here's the implementation of the formula in Go:
main.go242 chars16 lines
This will output:
main.go25 chars2 lines
You can change the value of n
to find the nth nonagonal number you want.
gistlibby LogSnag