Given a number N, the task is to find Nth icosikaiheptagonal number.
An icosikaiheptagonal number is a class of figurate numbers. It has 27 – sided polygon called icosikaiheptagon. The N-th icosikaiheptagonal number count’s the 27 number of dots and all other dots are surrounding with a common sharing corner and make a pattern. The first few icosikaiheptagonol numbers are 1, 27, 78, 154 …
Input: N = 2
The second icosikaiheptagonol number is 27.
Input: N = 3
Approach: The N-th icosikaiheptagonal number is given by the formula:
- Nth term of s sided polygon =
- Therefore Nth term of 27 sided polygon is
Below is the implementation of the above approach:
3rd icosikaiheptagonal Number is 78
Time Complexity: O(1)
Auxiliary Space: O(1)
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.