Open In App

Tetracontapentagon number

Last Updated : 23 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

A Tetracontapentagon Number is a class of figurate numbers. It has a 45 sided polygon called Tetracontapentagon. The N-th Tetracontapentagon number count’s the 45 number of dots and all other dots are surrounding with a common sharing corner and make a pattern.
First few Tetracontapentagonol Numbers are: 
 

1, 45, 132, 262,… 
 


 

Program to find the Nth Tetracontapentagon Number


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

Input: N = 2 
Output: 45 
Explanation: 
The second Tetracontapentagonol number is 45. 
Input: N = 3 
Output: 132 
 


 


Approach: The N-th Tetracontapentagon Number is given by the formula: 
 

  • N-th term of S sided polygon = \frac{((S - 2)N^{2} - (S - 4)N)}{2}
     
  • Therefore N-th term of 45 sided polygon is given by: 
     

Tn =\frac{((45 - 2)N^{2} - (45 - 4)N)}{2} =\frac{(43N^{2} - 41N)}{2}
 


  •  


Below is the implementation of the above approach:
 

C++

// C++ program for the above approach
#include <bits/stdc++.h>
using namespace std;
 
// Function to find the N-th
// Tetracontapentagon Number
int TetracontapentagonNum(int N)
{
    return (43 * N * N - 41 * N)
        / 2;
}
 
// Driver Code
int main()
{
    // Given Number
    int N = 3;
 
    // Function Call
    cout << TetracontapentagonNum(N);
 
    return 0;
}

                    

Java

// Java program for the above approach 
class GFG{
 
// Function to find the nth
// TetracontapentagonNum number
static int TetracontapentagonNum(int N)
{
    return (43 * N * N - 41 * N) / 2;
}
 
// Driver code
public static void main(String[] args)
{
    int n = 3;
    System.out.print(TetracontapentagonNum(n));
}
}
 
// This code is contributed by Pratima Pandey

                    

Python3

# Python3 program for the above approach
 
# Function to find the N-th
# Tetracontapentagon Number
def TetracontapentagonNum(N):
 
    return (43 * N * N - 41 * N) // 2;
 
# Driver Code
 
# Given Number
N = 3;
 
# Function Call
print(TetracontapentagonNum(N));
 
# This code is contributed by Code_Mech

                    

C#

// C# program for the above approach
using System;
class GFG{
 
// Function to find the nth
// TetracontapentagonNum number
static int TetracontapentagonNum(int N)
{
    return (43 * N * N - 41 * N) / 2;
}
 
// Driver code
public static void Main()
{
    int n = 3;
    Console.Write(TetracontapentagonNum(n));
}
}
 
// This code is contributed by Code_Mech

                    

Javascript

<script>
 
// Javascript program for the above approach 
 
 
    // Function to find the nth
    // TetracontapentagonNum number
    function TetracontapentagonNum( N) {
        return (43 * N * N - 41 * N) / 2;
    }
 
    // Driver code
      
        let n = 3;
        document.write(TetracontapentagonNum(n));
 
 
// This code contributed by gauravrajput1
 
</script>

                    

Output: 
132

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads