methods to check for heptagonal and octagonal numbers