Tetracontapentagon number
Last Updated :
23 Mar, 2021
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 =
- Therefore N-th term of 45 sided polygon is given by:
Below is the implementation of the above approach:
C++
#include <bits/stdc++.h>
using namespace std;
int TetracontapentagonNum( int N)
{
return (43 * N * N - 41 * N)
/ 2;
}
int main()
{
int N = 3;
cout << TetracontapentagonNum(N);
return 0;
}
|
Java
class GFG{
static int TetracontapentagonNum( int N)
{
return ( 43 * N * N - 41 * N) / 2 ;
}
public static void main(String[] args)
{
int n = 3 ;
System.out.print(TetracontapentagonNum(n));
}
}
|
Python3
def TetracontapentagonNum(N):
return ( 43 * N * N - 41 * N) / / 2 ;
N = 3 ;
print (TetracontapentagonNum(N));
|
C#
using System;
class GFG{
static int TetracontapentagonNum( int N)
{
return (43 * N * N - 41 * N) / 2;
}
public static void Main()
{
int n = 3;
Console.Write(TetracontapentagonNum(n));
}
}
|
Javascript
<script>
function TetracontapentagonNum( N) {
return (43 * N * N - 41 * N) / 2;
}
let n = 3;
document.write(TetracontapentagonNum(n));
</script>
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...