Pentacontahenagon Number
Last Updated :
24 Mar, 2021
Pentacontahenagon Number is a class of figurate numbers. It has a 51 sided polygon called Pentacontahenagon. The N-th Pentacontahenagon number count’s the 51 number of dots and all other dots are surrounding with a common sharing corner and make a pattern.
First few Pentacontahenagonol Numbers are:
1, 51, 150, 298,…
Program to find the Nth Pentacontahenagon Number
Given a number N, the task is to find NthNumber.
Examples:
Input: N = 2
Output: 51
Explanation:
The second Pentacontahenagonol number is 51.
Input: N = 3
Output: 150
Approach: The N-th Pentacontahenagon number is given by the formula:
- N-th term of S sided polygon =
- Therefore N-th term of 51 sided polygon is given by:
Below is the implementation of the above approach:
C++
#include <bits/stdc++.h>
using namespace std;
int PentacontahenagonNum( int N)
{
return (49 * N * N - 47 * N)
/ 2;
}
int main()
{
int N = 3;
cout << "3rd Pentacontahenagon Number is "
<< PentacontahenagonNum(N);
return 0;
}
|
Java
import java.util.*;
class GFG{
static int PentacontahenagonNum( int N)
{
return ( 49 * N * N - 47 * N) / 2 ;
}
public static void main(String[] args)
{
int N = 3 ;
System.out.print( "3rd Pentacontahenagon Number is " +
PentacontahenagonNum(N));
}
}
|
Python3
def PentacontahenagonNum(N):
return ( 49 * N * N - 47 * N) / / 2 ;
N = 3 ;
print ( "3rd Pentacontahenagon Number is" ,
PentacontahenagonNum(N));
|
C#
using System;
class GFG{
static int PentacontahenagonNum( int N)
{
return (49 * N * N - 47 * N) / 2;
}
public static void Main()
{
int N = 3;
Console.Write( "3rd Pentacontahenagon Number is " +
PentacontahenagonNum(N));
}
}
|
Javascript
<script>
function PentacontahenagonNum( N) {
return (49 * N * N - 47 * N) / 2;
}
let N = 3;
document.write( "3rd Pentacontahenagon Number is " + PentacontahenagonNum(N));
</script>
|
Output: 3rd Pentacontahenagon Number is 150
Share your thoughts in the comments
Please Login to comment...