4294967295-gon Number - GeeksforGeeks

24 Mar, 2021
4294967295-gon Number is a class of figurate numbers. It has a 4294967295 sided polygon called 4294967295-gon. The N-th 4294967295-gon number counts the 4294967295 number of dots and all other dots are surrounding with a common sharing corner and make a pattern.The first few 4294967295-gonol numbers are:  
1, 4294967295, 12884901882,...  
 
Given a number N, the task is to find Nth 4294967295-gon number. Examples:  
Input: N = 2 Output: 4294967295 Explanation: The second 4294967295-gonol number is 4294967295. Input: N = 3 Output: 12884901882  
 
Approach: The N-th 4294967295-gon number is given by the formula:  
N-th term of S sided polygon =  
Therefore N-th term of 4294967295 sided polygon is given by:  
 
 
Below is the implementation of the above approach:  
C++
Java
Python3
C#
Javascript
// C++ program to find N-th// TetracontapentagonNum number#include<bits/stdc++.h>using namespace std; // Function to find the nth// 4294967295-gon numberstatic long gonNum4294967295(int N){    return (4294967293L * N *        N - 4294967291L * N) / 2;} // Driver codeint main(){    int n = 3;    cout << "3rd 4294967295-gon Number is "         << gonNum4294967295(n);} // This code is contributed by Code_Mech
// Java program to find N-th// TetracontapentagonNum numberclass GFG{ // Function to find the nth// 4294967295-gon numberstatic long gonNum4294967295(int N){    return (4294967293L * N *        N - 4294967291L * N) / 2;} // Driver codepublic static void main(String[] args){    int n = 3;    System.out.print("3rd 4294967295-gon Number is " +                                 gonNum4294967295(n));}} // This code is contributed by Pratima Pandey
# Python3 program to find the N-th# 4294967295-gon number # Function to find the N-th# 4294967295-gon numberdef gonNum4294967295(N):     return (4294967293 * N * N - 4294967291 * N) // 2 # Driver Code # Given Numbern = 3 # Function Callprint("3rd 4294967295-gon Number is ",                gonNum4294967295(n))
// C# program to find N-th// TetracontapentagonNum numberusing System;class GFG{ // Function to find the nth// 4294967295-gon numberstatic long gonNum4294967295(int N){    return (4294967293L * N *        N - 4294967291L * N) / 2;} // Driver codepublic static void Main(){    int n = 3;    Console.Write("3rd 4294967295-gon Number is " +                              gonNum4294967295(n));}} // This code is contributed by Code_Mech
<script>// Javascript program to find N-th// TetracontapentagonNum number     // Function to find the nth    // 4294967295-gon number    function gonNum4294967295(N)    {        return ((4294967293 * N * N ) - (4294967291 * N)) / 2;    }     // Driver code          let n = 3;    document.write("3rd 4294967295-gon Number is " + gonNum4294967295(n));         // This code is contributed by aashish1995</script>
3rd 4294967295-gon Number is  12884901882
 
dewantipandeydp
Code_Mech
aashish1995
series
Mathematical
Mathematical
series
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Find all factors of a natural number | Set 1
Check if a number is Palindrome
Program to print prime numbers from 1 to N.
Program to add two binary strings
Fizz Buzz Implementation
Program to multiply two matrices
Find pair with maximum GCD in an array
Find Union and Intersection of two unsorted arrays
Count all possible paths from top left to bottom right of a mXn matrix
Count ways to reach the n'th stair