Here is a function that calculates the nth heptagonal number using the formula: n(5n-3)/2
main.swift74 chars4 linesTo use this function to find the nth heptagonal number, simply call the function with the desired value of n:
main.swift60 chars2 linesThis will give you the nth heptagonal number, where n is the input value passed to the function.
gistlibby LogSnag