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
- Heptagonal number
- Centered Octagonal Number
- Centered Octadecagonal Number
- Centered pentagonal number
- Centered decagonal number
- Centered Octahedral number
- Centered Dodecagonal Number
- Centered nonadecagonal number
- Centered tridecagonal number
- Centered triangular number
- Centered Hexadecagonal Number
- Centered hexagonal number
- Centered cube number
- Centered tetrahedral 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 firstname.lastname@example.org. 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.