Open In App

Pentacontahenagon Number

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

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 = \frac{((S - 2)N^{2} - (S - 4)N)}{2}
     
  • Therefore N-th term of 51 sided polygon is given by: 
     

Tn =\frac{((51 - 2)N^{2} - (51 - 4)N)}{2} =\frac{(49N^{2} - 47N)}{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
// Pentacontahenagon Number
int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N)
        / 2;
}
 
// Driver Code
int main()
{
    int N = 3;
 
// Function Call
    cout << "3rd Pentacontahenagon Number is "
        << PentacontahenagonNum(N);
 
    return 0;
}

                    

Java

// Java program for the above approach
import java.util.*;
class GFG{
 
// Function to find the N-th
// Pentacontahenagon Number
static int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N) / 2;
}
 
// Driver Code
public static void main(String[] args)
{
    int N = 3;
 
    // Function Call
    System.out.print("3rd Pentacontahenagon Number is " +
                                PentacontahenagonNum(N));
}
}
 
// This code is contributed by Rajput-Ji

                    

Python3

# Python3 program for the above approach
 
# Function to find the N-th
# Pentacontahenagon Number
def PentacontahenagonNum(N):
 
    return (49 * N * N - 47 * N) // 2;
 
# Driver Code
N = 3;
 
# Function Call
print("3rd Pentacontahenagon Number is",
               PentacontahenagonNum(N));
 
# This code is contributed by Code_Mech

                    

C#

// C# program for the above approach
using System;
class GFG{
 
// Function to find the N-th
// Pentacontahenagon Number
static int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N) / 2;
}
 
// Driver Code
public static void Main()
{
    int N = 3;
 
    // Function Call
    Console.Write("3rd Pentacontahenagon Number is " +
                             PentacontahenagonNum(N));
}
}
 
// This code is contributed by Code_Mech

                    

Javascript

<script>
// Javascript program for the above approach
 
    // Function to find the N-th
    // Pentacontahenagon Number
    function PentacontahenagonNum( N) {
        return (49 * N * N - 47 * N) / 2;
    }
 
    // Driver Code
      
        let N = 3;
 
        // Function Call
        document.write("3rd Pentacontahenagon Number is " + PentacontahenagonNum(N));
 
// This code is contributed by aashish1995
</script>

                    

Output: 
3rd Pentacontahenagon Number is 150

 


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads