Tetracontaoctagonal Number
Last Updated :
18 Mar, 2021
Given a number N, the task is to find Nth Tetracontaoctagon number.
A Tetracontaoctagon number is a class of figurate numbers. It has a 48-sided polygon called Tetracontaoctagon. The N-th Tetracontaoctagonal number count’s the 48 number of dots and all other dots are surrounding with a common sharing corner and make a pattern. The first few Tetracontaoctagonol numbers are 1, 48, 141, 280, 465, 696, …
Examples:
Input: N = 2
Output: 48
Explanation:
The second Tetracontaoctagonol number is 48.
Input: N = 3
Output: 141
Approach: The N-th Tetracontaoctagonal number is given by the formula:
- Nth term of s sided polygon =
- Therefore Nth term of 48 sided polygon is
Below is the implementation of the above approach:
C++
#include <bits/stdc++.h>
using namespace std;
int TetracontaoctagonalNum( int n)
{
return (46 * n * n - 44 * n) / 2;
}
int main()
{
int n = 3;
cout << TetracontaoctagonalNum(n);
return 0;
}
|
Java
class GFG{
static int TetracontaoctagonalNum( int n)
{
return ( 46 * n * n - 44 * n) / 2 ;
}
public static void main(String[] args)
{
int n = 3 ;
System.out.print(TetracontaoctagonalNum(n));
}
}
|
Python3
def TetracontaoctagonalNum(n):
return ( 46 * n * n - 44 * n) / 2 ;
n = 3 ;
print (TetracontaoctagonalNum(n));
|
C#
using System;
class GFG{
static int TetracontaoctagonalNum( int n)
{
return (46 * n * n - 44 * n) / 2;
}
public static void Main()
{
int n = 3;
Console.Write(TetracontaoctagonalNum(n));
}
}
|
Javascript
<script>
function TetracontaoctagonalNum(n)
{
return (46 * n * n - 44 * n) / 2;
}
var n = 3;
document.write(TetracontaoctagonalNum(n));
</script>
|
Reference: https://en.wikipedia.org/wiki/Tetracontaoctagon
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...