Given a number N, the task is to find the sum of first N Centered Octadecagonal numbers.
Input: N = 3
1, 19 and 55 are the first three centered octadecagonal numbers.
Input: N = 10
- Initially, we need to create a function which will help us to calculate the Nth centered octadecagonal number.
- Now, run a loop starting from 1 to N, to find ith centered octadecagonal numbers.
- Add all the above calculated centered octadecagonal numbers.
- Finally, display the sum of the first N centered octadecagonal 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 Octadecagonal Number
- Program to check if N is a Centered Octadecagonal number
- Octadecagonal Number
- Find the sum of the first Nth Centered Tridecagonal Numbers
- Find the sum of the first N Centered Decagonal Numbers
- 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 Nth Centered Pentadecagonal Number
- Find the sum of the first Nth Centered Hexadecagonal Number
- Find the sum of the first N Centered Octagonal Number
- Find the sum of the first N Centered heptagonal number
- Centered cube number
- Centered Dodecagonal Number
- Centered hexagonal number
- Program for centered nonagonal number
- Centered triangular number
- Centered tetrahedral number
- Centered heptagonal number
- Program for Centered Icosahedral Number
- Centered Square 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.