Given a number N, the task is to find Nth Icosachiliagon number.
A Icosachiliagon number is class of figurate number. It has 20000 – sided polygon called Icosachiliagon. The N-th Icosachiliagon number count’s the 20000 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The first few Icosachiliagonol numbers are 1, 20000, 59997, 119992, 199985 …
Examples :
Input : N = 2 Output : 20000 Explanation : The second Icosachiliagonol number is 20000. Input : N = 3 Output : 59997
Approach :
The N-th Icosachiliagon number is given by the formula:
- Nth term of s sided polygon =
\[\frac{((s-2)n^2 – (s-4)n)}{2}\]
- Therefore Nth term of 20000 sided polygon is
\[Tn =\frac{((20000-2)n^2 – (20000-4)n)}{2} =\frac{(19998n^2 – 19996n)}{2}\]
Implementation :
# Python3 program to find the N-th
# Icosachiliagon number
# Function to find the N-th
# Icosachiliagon number
def IcosachiliagonNum(N):
return (19998 * N * N - 19996 * N) // 2
# Driver code
n = 3
print(IcosachiliagonNum(n))
Output :
59997