A tetracontakaipentagon number is class of figurate number. It has – 45 sided polygon called tetracontakaipentagon. The N-th tetracontakaipentagon number count’s the 45 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The first few tetracontakaipentagon numbers are 1, 45, 132, 262,…
Given a number N, to find Nth tetracontakaipentagon number.
Examples :
Input : N = 4 Output : 262 Input : N = 8 Output : 1212
Approach :
The N-th tetracontakaipentagon number is given by the formula:
N-th term of S sided polygon = {((S – 2)N^2 – (S – 4)N)}/{2}
Therefore N-th term of 45 sided polygon is given by:
Tn ={((45 - 2)N^2 - (45 - 4)N)}/{2} ={(43N^2 - 41N)}/{2}
Implementation :
// C# program for the above approach
using System;
class W3C{
// Finding the nth tetracontakaipentagon number
static int tetracontakaipentagon (int n)
{
return (43 * n * n - 41* n) / 2;
}
// Driver code
public static void Main()
{
int n = 8;
Console.Write("Tetracontakaipentagon Number = " +tetracontakaipentagon (n));
}
}
Output :
Tetracontakaipentagon Number = 1212