To find the nth heptagonal number, you can use the following formula:
index.tsx14 chars2 lines
where n
is the ordinal number of the heptagonal number you want to find.
Here's a function in JavaScript that takes an input n
and returns the corresponding heptagonal number:
index.tsx63 chars4 lines
You can then call this function with any value of n
to get the corresponding heptagonal number:
index.tsx174 chars6 lines
Note that the heptagonal numbers are a sequence of figurate numbers, with each polygonal number having seven sides.
gistlibby LogSnag