The **Second hexagonal numbers** series can be represented as

3, 10, 21, 36, 55, 78, 105, 136, 171, 210, 253, …..

Nth term

Given an integer **N**. The task is to find the N-th term of the given series.**Examples**:

Input:N = 1Output:3Input:N = 4Output:36

**Approach:** The idea is to find the general term for the Second hexagonal numbers. Below is the computation of the general term for second hexagonal numbers:

1st Term = 1 * (2*1 + 1) = 3

2nd term = 2 * (2*2 + 1) = 10

3rd term = 3 * (2*3 + 1) = 21

4th term = 4 * (2*4 + 1) = 36

.

.

.

Nth term = n * (2*n + 1)

Therefore, the Nth term of the series is given as

Below is the implementation of above approach:

## C++

`// C++ implementation to ` `// find N-th term ` `// in the series ` `#include <iostream> ` `#include <math.h> ` `using` `namespace` `std; ` ` ` `// Function to find N-th term ` `// in the series ` `void` `findNthTerm(` `int` `n) ` `{ ` ` ` `cout << n * (2 * n + 1) << endl; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `N = 4; ` ` ` `findNthTerm(N); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java implementation to ` `// find N-th term ` `// in the series ` `class` `GFG{ ` ` ` `// Function to find N-th term ` `// in the series ` `static` `void` `findNthTerm(` `int` `n) ` `{ ` ` ` `System.out.print(n * (` `2` `* n + ` `1` `)); ` `} ` ` ` `// Driver code ` `public` `static` `void` `main (String[] args) ` `{ ` ` ` `int` `N = ` `4` `; ` ` ` `findNthTerm(N); ` `} ` `} ` ` ` `// This code is contributed by Ritik Bansal ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 implementation to ` `# find N-th term ` `# in the series ` ` ` `# Function to find N-th term ` `# in the series ` `def` `findNthTerm(n): ` ` ` `print` `(n ` `*` `(` `2` `*` `n ` `+` `1` `)) ` ` ` `# Driver code ` `N ` `=` `4` ` ` `# Function call ` `findNthTerm(N) ` ` ` `# This code is contributed by Vishal Maurya` |

*chevron_right*

*filter_none*

## C#

`// C# implementation to ` `// find N-th term ` `// in the series ` `using` `System; ` `class` `GFG{ ` ` ` `// Function to find N-th term ` `// in the series ` `static` `void` `findNthTerm(` `int` `n) ` `{ ` ` ` `Console.Write(n * (2 * n + 1)); ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main() ` `{ ` ` ` `int` `N = 4; ` ` ` `findNthTerm(N); ` `} ` `} ` ` ` `// This code is contributed by Code_Mech ` |

*chevron_right*

*filter_none*

**Output:**

36

**Reference:**OEIS

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.

## Recommended Posts:

- Concentric Hexagonal Numbers
- Find all numbers up to N which are both Pentagonal and Hexagonal
- Hexagonal Number
- Centered hexagonal number
- Surface Area and Volume of Hexagonal Prism
- Program to check if N is a Centered Hexagonal Number
- Program to check if N is a Hexagonal Number or not
- Program to check if N is a Concentric Hexagonal Number
- Sum of elements in range L-R where first half and second half is filled with odd and even numbers
- Find prime numbers in the first half and second half of an array
- Find numbers which are multiples of first array and factors of second array
- Second decagonal numbers
- Second-order Eulerian numbers
- Second heptagonal numbers
- Second Pentagonal numbers
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Total distinct pairs from two arrays such that second number can be obtained by inverting bits of first
- Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array
- Number of hours after which the second person moves ahead of the first person if they travel at a given speed
- Sum of all second largest divisors after splitting a number into one or more parts

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.