# Enneadecagonal number

Given a number n, the task is to find the nth Enneadecagonal number.

An Enneadecagonal number is a nineteen-sided polygon in mathematics. It belongs to a class of figurative number. The number contains the number of dots and the dots are arranged in a pattern or series. An Enneadecagonal number is also known as nonadecagon. The dots have common points and all other dots are arrange in the successive layer.

**Examples :**

Input : 4

Output :106Input :10

Output :775

Formula to find nth Enneadecagonal number :

## C++

`// C++ program to find ` `// nth Enneadecagonal number ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to calculate ` `// Enneadecagonal number ` `int` `nthEnneadecagonal(` `long` `int` `n) ` `{ ` ` ` `// Formula for finding ` ` ` `// nth Enneadecagonal number ` ` ` `return` `(17 * n * n - 15 * n) / 2; ` `} ` ` ` `// Drivers code ` `int` `main() ` `{ ` ` ` `long` `int` `n = 6; ` ` ` `cout << n << ` `"th Enneadecagonal number :"` `<< nthEnneadecagonal(n); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find ` `// nth Enneadecagonal number ` `import` `java.io.*; ` ` ` `class` `GFG { ` ` ` ` ` `// Function to calculate ` ` ` `// Enneadecagonal number ` ` ` `static` `int` `nthEnneadecagonal(` `int` `n) ` ` ` `{ ` ` ` ` ` `// Formula for finding ` ` ` `// nth Enneadecagonal number ` ` ` `return` `(` `17` `* n * n - ` `15` `* n) / ` `2` `; ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `main (String[] args) ` ` ` `{ ` ` ` ` ` `int` `n = ` `6` `; ` ` ` `System.out.print(n + ` `"th Enneadecagonal number :"` `); ` ` ` ` ` `System.out.println( nthEnneadecagonal(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by m_kit. ` |

*chevron_right*

*filter_none*

## Python3

`# Program to find nth ` `# Enneadecagonal number ` ` ` `def` `nthEnneadecagonal(n) : ` ` ` ` ` `# Formula to calculate nth ` ` ` `# Enneadecagonal number ` ` ` `return` `(` `17` `*` `n ` `*` `n ` `-` `15` `*` `n) ` `/` `/` `2` ` ` `# Driver Code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` ` ` `n ` `=` `6` ` ` `print` `(n,` `"th Enneadecagonal number :"` ` ` `, nthEnneadecagonal(n)) ` ` ` `# This code is contributed by Ajit ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find ` `// nth Enneadecagonal number ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to calculate ` ` ` `// Enneadecagonal number ` ` ` `static` `int` `nthEnneadecagonal(` `int` `n) ` ` ` `{ ` ` ` ` ` `// Formula for finding ` ` ` `// nth Enneadecagonal number ` ` ` `return` `(17 * n * n - 15 * n) / 2; ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `static` `public` `void` `Main () ` ` ` `{ ` ` ` `int` `n = 6; ` ` ` `Console.Write(n + ` `"th Enneadecagonal number :"` `); ` ` ` ` ` `Console.WriteLine( nthEnneadecagonal(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by aj_36 ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find ` `// nth Enneadecagonal number ` ` ` `// Function to calculate ` `// Enneadecagonal number ` `function` `nthEnneadecagonal(` `$n` `) ` `{ ` ` ` `// Formula for finding ` ` ` `// nth Enneadecagonal number ` ` ` `return` `(17 * ` `$n` `* ` `$n` `- ` ` ` `15 * ` `$n` `) / 2; ` `} ` ` ` `// Driver Code ` `$n` `= 6; ` `echo` `$n` `, ` `"th Enneadecagonal number :"` `, ` ` ` `nthEnneadecagonal(` `$n` `); ` ` ` `// This code is contributed by ajit ` `?> ` |

*chevron_right*

*filter_none*

**Output :**

6th Enneadecagonal number :261

Reference: https://en.wikipedia.org/wiki/Polygonal_number

## Recommended Posts:

- Count number of trailing zeros in Binary representation of a number using Bitset
- Find minimum number to be divided to make a number a perfect square
- Count number of triplets with product equal to given number with duplicates allowed
- Given number of matches played, find number of teams in tournament
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Number of times the largest perfect square number can be subtracted from N
- Find the number of integers x in range (1,N) for which x and x+1 have same number of divisors
- Check if a number is divisible by all prime divisors of another number
- Super Ugly Number (Number whose prime factors are in given set)
- Program to Convert Octal Number to Binary Number
- Count Number of animals in a zoo from given number of head and legs
- Check whether all the rotations of a given number is greater than or equal to the given number or not
- Find count of digits in a number that divide the number
- Find the smallest number whose digits multiply to a given number n
- Build Lowest Number by Removing n digits from a given number

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.