# Icositrigonal Number

Given a number N, the task is to find Nth Icositrigonal number or not.

An Icositrigonal number is class of figurate number. It has 23 – sided polygon called Icositrigon. The N-th Icositrigonal number count’s the 23 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The first few Icositrigonol numbers are 1, 23, 66, 130, 215, 321, 448 …

Examples:

Input: N = 2
Output: 23
Explanation:
The second Icositrigonol number is 66.

Input: N = 6
Output: 321

## Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Approach: The N-th Icositrigonal number is given by the formula:

``` ```

Below is the implementation of the above approach:

## C++

 `// C++ program to find nth  ` `// Icositrigonal number  ` ` `  `#include   ` `using` `namespace` `std;  ` ` `  `// Function to find N-th  ` `// Icositrigonal number  ` `int` `Icositrigonal_num(``int` `n)  ` `{  ` `    ``// Formula to calculate nth  ` `    ``// Icositrigonal number  ` `    ``return` `(21 * n * n - 19 * n) / 2;  ` `}  ` ` `  `// Driver Code  ` `int` `main()  ` `{  ` `    ``int` `n = 3;  ` `    ``cout << Icositrigonal_num(n) << endl;  ` `     `  `    ``n = 10;  ` `    ``cout << Icositrigonal_num(n);  ` ` `  `    ``return` `0;  ` `}  `

## Java

 `// Java program to find nth  ` `// Icositrigonal number  ` `class` `GFG{ ` ` `  `// Function to find N-th  ` `// Icositrigonal number     ` `static` `int` `IcositrigonalNum(``int` `n) ` `{  ` `     `  `    ``// Formula to calculate nth  ` `    ``// Icositrigonal number  ` `    ``return` `(``21` `* n * n - ``19` `* n) / ``2``;  ` `} ` ` `  `// Driver code ` `public` `static` `void` `main(String[] args) ` `{ ` `    ``int` `n = ``3``; ` `    ``System.out.print(IcositrigonalNum(n) + ``"\n"``); ` `     `  `    ``n = ``10``; ` `    ``System.out.print(IcositrigonalNum(n)); ` `} ` `} ` ` `  `// This code is contributed by spp____ `

## Python3

 `# Python3 program to find nth  ` `# Icositrigonal number  ` ` `  `# Function to find N-th  ` `# Icositrigonal number  ` `def` `IcositrigonalNum(n): ` `     `  `    ``# Formula to calculate nth  ` `    ``# Icositrigonal number  ` `    ``return` `(``21` `*` `n ``*` `n ``-` `19` `*` `n) ``/` `2``;  ` ` `  `# Driver code ` `n ``=` `3` `print``(IcositrigonalNum(n)) ` ` `  `n ``=` `10` `print``(IcositrigonalNum(n)) ` ` `  `# This code is contributed by spp____ `

## C#

 `// C# program to find nth  ` `// Icositrigonal number  ` `using` `System; ` ` `  `class` `GFG{ ` ` `  `// Function to find N-th  ` `// Icositrigonal number      ` `static` `int` `IcositrigonalNum(``int` `n) ` `{ ` `     `  `    ``// Formula to calculate nth  ` `    ``// Icositrigonal number  ` `    ``return` `(21 * n * n - 19 * n) / 2;  ` `} ` ` `  `// Driver code ` `public` `static` `void` `Main() ` `{ ` `    ``int` `n = 3; ` `    ``Console.WriteLine(IcositrigonalNum(n)); ` `     `  `    ``n = 10; ` `    ``Console.WriteLine(IcositrigonalNum(n)); ` `} ` `} ` ` `  `// This code is contributed by spp____ `

Output:

```66
955
```

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Improved By : spp____

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.