Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Icosikaienneagonal Number

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

An icosikaienneagonal number is a class of figurate numbers. It has 29 – sided polygon called icosikaienneagon. The N-th icosikaienneagonal number count’s the 29 number of dots and all other dots are surrounding with a common sharing corner and make a pattern.
The first few icosikaienneagonol numbers are 
 

1, 29, 84, 166 … 
 

 

Find the Nth icosikaienneagonal number

Given a number N, the task is to find Nth icosikaienneagonal number.
Examples: 
 

Input: N = 2 
Output: 29 
Explanation: 
The second icosikaienneagonol number is 29. 
Input: N = 3 
Output: 84 
 

 

Approach: 
 

  • In mathematics, the N-th s-sided polygon number is given by the formula: 
    \text{Nth term of s sided polygon} = \frac{((s-2)n^2 - (s-4)n)}{2}
     
  • Therefore Nth term of 29 sided polygon is 
     

Tn =\frac{((29-2)n^2 - (29-4)n)}{2} =\frac{(27n^2 - 25n)}{2}

  •  

Below is the implementation of the above approach:
 

C++




// C++ implementation for
// above approach
 
#include <iostream>
using namespace std;
 
// Function to Find the Nth
// icosikaienneagonal Number
int icosikaienneagonalNum(int n)
{
    return (27 * n * n - 25 * n) / 2;
}
 
// Driver Code
int main()
{
    int n = 3;
    cout << icosikaienneagonalNum(n);
 
    return 0;
}

Java




// Java implementation for
// above approach
class GFG{
 
// Function to Find the Nth
// icosikaienneagonal Number
static int icosikaienneagonalNum(int n)
{
    return (27 * n * n - 25 * n) / 2;
}
 
// Driver Code
public static void main(String args[])
{
    int n = 3;
    System.out.print(icosikaienneagonalNum(n));
}
}
 
// This code is contributed by Code_Mech

Python 3




# Python3 implementation for
# above approach
 
# Function to Find the Nth
# icosikaienneagonal Number
def icosikaienneagonalNum(n):
    return (27 * n * n - 25 * n) // 2
 
# Driver Code
 
# Given N
N = 3
print(icosikaienneagonalNum(N))
 
# This code is contributed by Vishal Maurya

C#




// C# implementation for
// above approach
using System;
class GFG{
 
// Function to Find the Nth
// icosikaienneagonal Number
static int icosikaienneagonalNum(int n)
{
    return (27 * n * n - 25 * n) / 2;
}
 
// Driver Code
public static void Main()
{
    int n = 3;
    Console.Write(icosikaienneagonalNum(n));
}
}
 
// This code is contributed by Code_Mech

Javascript




<script>
// Javascript implementation for
// above approach
 
 
    // Function to Find the Nth
    // icosikaienneagonal Number
    function icosikaienneagonalNum( n) {
        return (27 * n * n - 25 * n) / 2;
    }
 
    // Driver Code
      
    let n = 3;
    document.write(icosikaienneagonalNum(n));
 
// This code is contributed by Rajput-Ji
</script>

Output: 

84

 

Time Complexity: O(1)

Auxiliary Space: O(1)


My Personal Notes arrow_drop_up
Last Updated : 16 Jul, 2021
Like Article
Save Article
Similar Reads
Related Tutorials