Given a number N, the task is to find the sum of the first N Centered Hexadecagonal Number.
The first few Centered Hexadecagonal Numbers are 1, 17, 49, 97, 161, 241 …
Input: N = 3
1, 17 and 49 are the first three centered Hexadecagonal numbers.
Input: N = 5
- Initially, we need to create a function which will help us to calculate the Nth Centered Hexadecagonal number.
- Now, we run a loop starting from 1 to N, to find ith Centered Hexadecagonal number.
- Add all the above calculated Centered Hexadecagonal numbers.
- Finally, display the sum of 1st N Centered Hexadecagonal numbers.
Below is the implementation of the above approach:
Time Complexity: O(N)
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.
- Centered Hexadecagonal Number
- Program to check if N is a Centered Hexadecagonal Number
- Find the sum of the first Nth Centered Pentadecagonal Number
- Find the sum of the first Nth Centered Tridecagonal Numbers
- Hexadecagonal number
- Program to check if N is a Hexadecagonal Number
- Find the sum of the first N Centered Pentagonal Number
- Find the sum of the first N Centered Dodecagonal Number
- Find the sum of the first N Centered Octagonal Number
- Find the sum of the first N Centered heptagonal number
- Find the sum of the first N Centered Decagonal Numbers
- Find the sum of the first N Centered Octadecagonal Numbers
- Find the sum of the first Nth Heptadecagonal Number
- Find the sum of the first Nth Icosidigonal Number
- Find the sum of the first Nth Icosagonal Numbers
- Compare sum of first N-1 elements to Nth element of an array
- Centered cube number
- Centered Dodecagonal Number
- Centered hexagonal number
- Program for centered nonagonal 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.