4294967295-gon Number
Last Updated :
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,…
Check if N is a 4294967295-gon Number
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++
#include<bits/stdc++.h>
using namespace std;
static long gonNum4294967295( int N)
{
return (4294967293L * N *
N - 4294967291L * N) / 2;
}
int main()
{
int n = 3;
cout << "3rd 4294967295-gon Number is "
<< gonNum4294967295(n);
}
|
Java
class GFG{
static long gonNum4294967295( int N)
{
return (4294967293L * N *
N - 4294967291L * N) / 2 ;
}
public static void main(String[] args)
{
int n = 3 ;
System.out.print( "3rd 4294967295-gon Number is " +
gonNum4294967295(n));
}
}
|
Python3
def gonNum4294967295(N):
return ( 4294967293 * N * N - 4294967291 * N) / / 2
n = 3
print ( "3rd 4294967295-gon Number is " ,
gonNum4294967295(n))
|
C#
using System;
class GFG{
static long gonNum4294967295( int N)
{
return (4294967293L * N *
N - 4294967291L * N) / 2;
}
public static void Main()
{
int n = 3;
Console.Write( "3rd 4294967295-gon Number is " +
gonNum4294967295(n));
}
}
|
Javascript
<script>
function gonNum4294967295(N)
{
return ((4294967293 * N * N ) - (4294967291 * N)) / 2;
}
let n = 3;
document.write( "3rd 4294967295-gon Number is " + gonNum4294967295(n));
</script>
|
Output: 3rd 4294967295-gon Number is 12884901882
Share your thoughts in the comments
Please Login to comment...