Given a number n, the task is to find nth Centered heptagonal number.
Centered heptagonal number is centered figure number that represents a heptagon with dot in center and all other dot surrounding in heptagonal form. Nth centered heptagonal number can be calculated by using formula (7n2 – 7n + 2) / 2.
Input : n = 2 Output : 8 Input : n = 7 Output : 148
Please refer this diagram for pictorial representation.
Below is the implementation :
5th Centered heptagonal number : 71
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to check if N is a Centered heptagonal number
- Find the sum of the first N Centered heptagonal number
- Heptagonal number
- Program to check if N is a Heptagonal Number
- Second heptagonal numbers
- Centered cube number
- Centered Dodecagonal Number
- Centered hexagonal number
- Program for centered nonagonal number
- Centered Octadecagonal Number
- Centered triangular number
- Centered tetrahedral number
- Program for Centered Icosahedral Number
- Centered Square Number
- Centered pentagonal number
- Centered Octahedral number
- Centered Octagonal Number
- Centered decagonal number
- Centered nonadecagonal number
- Centered Pentadecagonal Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.