Given a number **N**, the task is to find the **Nth** term of the series **2, 15, 41, 80, 132…**.

**Examples:**

Input:N = 2

Output:15

Input:N = 5

Output:132

**Approach:** From the given series, the formula for Nth term can be found as:

1st term = 2 2nd term = 2 + 1 * 13 = 15 3rd term = 15 + 2 * 13 = 41 4th term = 41 + 3 * 13 = 80 . . Nth term = (N - 1)th term + (N - 1) * 13

Therefore, the **Nth term** of the series is given as

Below are the steps to find the **Nth** term using recursion:

Recursively iterate from value **N**:

**Base case:**If the value called recursively is 1, then it is the first term of the series. Therefore return 2 from the function.if(N == 1) return 2;

**Recursive call:**If the base case is not met, then recursively iterate from the function according to the**Nth term**of the series:(N - 1) * 13 + func(N - 1);

**Return statement:**At each recursive call(except the base case), return the recursive function for next iteration.return ((13 * (N - 1)) + func(N, i + 1));

Below is the implementation of the above approach:

## C++

`// C++ program for the above approach ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Recursive function to find Nth term ` `int` `nthTerm(` `int` `N) ` `{ ` ` ` `// Base Case ` ` ` `if` `(N == 1) { ` ` ` `return` `2; ` ` ` `} ` ` ` ` ` `// Recursive Call according to ` ` ` `// Nth term of the series ` ` ` `return` `((N - 1) * 13) ` ` ` `+ nthTerm(N - 1); ` `} ` ` ` `// Driver Code ` `int` `main() ` `{ ` ` ` `// Input Nth term ` ` ` `int` `N = 17; ` ` ` ` ` `// Function call ` ` ` `cout << nthTerm(N) << endl; ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program for the above approach ` ` ` `class` `GFG{ ` ` ` `// Recursive function to find Nth term ` `static` `int` `nthTerm(` `int` `N) ` `{ ` ` ` `// Base Case ` ` ` `if` `(N == ` `1` `) ` ` ` `{ ` ` ` `return` `2` `; ` ` ` `} ` ` ` ` ` `// Recursive Call according to ` ` ` `// Nth term of the series ` ` ` `return` `((N - ` `1` `) * ` `13` `) + ` ` ` `nthTerm(N - ` `1` `); ` `} ` ` ` `// Driver Code ` `public` `static` `void` `main(String[] args) ` `{ ` ` ` `// Input Nth term ` ` ` `int` `N = ` `17` `; ` ` ` ` ` `// Function call ` ` ` `System.out.print(nthTerm(N) + ` `"\n"` `); ` `} ` `} ` ` ` `// This code is contributed by 29AjayKumar ` |

*chevron_right*

*filter_none*

## Python 3

`# Python 3 program for the above approach ` ` ` `# Recursive function to find Nth term ` `def` `nthTerm(N): ` ` ` ` ` `# Base Case ` ` ` `if` `(N ` `=` `=` `1` `): ` ` ` `return` `2` ` ` ` ` `# Recursive Call according to ` ` ` `# Nth term of the series ` ` ` `return` `((N ` `-` `1` `) ` `*` `13` `) ` `+` `nthTerm(N ` `-` `1` `) ` ` ` `# Driver Code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` ` ` `# Input Nth term ` ` ` `N ` `=` `17` ` ` ` ` `# Function call ` ` ` `print` `(nthTerm(N)) ` ` ` `# This code is contributed by Bhupendra_Singh ` |

*chevron_right*

*filter_none*

## C#

`// C# program for the above approach ` `using` `System; ` ` ` `public` `class` `GFG{ ` ` ` `// Recursive function to find Nth term ` `static` `public` `int` `nthTerm(` `int` `N) ` `{ ` ` ` `// Base Case ` ` ` `if` `(N == 1) ` ` ` `{ ` ` ` `return` `2; ` ` ` `} ` ` ` ` ` `// Recursive Call according to ` ` ` `// Nth term of the series ` ` ` `return` `((N - 1) * 13) + nthTerm(N - 1); ` `} ` ` ` `// Driver Code ` `static` `public` `void` `Main () ` `{ ` ` ` `// Input Nth term ` ` ` `int` `N = 17; ` ` ` ` ` `// Function call ` ` ` `Console.WriteLine(nthTerm(N)); ` `} ` `} ` ` ` `//This code is contributed by shubhamsingh10 ` |

*chevron_right*

*filter_none*

**Output:**

1770

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:

- Nth term where K+1th term is product of Kth term with difference of max and min digit of Kth term
- Find the Nth term of the series where each term f[i] = f[i - 1] - f[i - 2]
- Find Nth term of the series where each term differs by 6 and 2 alternately
- Nth term of a sequence formed by sum of current term with product of its largest and smallest digit
- Program to find Nth term in the given Series
- Program to find the Nth term of the series 3, 7, 13, 21, 31.....
- Program to find Nth term of series 1, 3, 12, 60, 360…
- Program to find the Nth term of series -1, 2, 11, 26, 47......
- Program to find Nth term in the series 0, 0, 2, 1, 4, 2, 6, 3, 8,...
- Program to find Nth term of series 9, 23, 45, 75, 113...
- Program to find Nth term in the series 0, 2, 1, 3, 1, 5, 2, 7, 3,…
- Find Nth term of series 1, 4, 15, 72, 420...
- Find Nth term of the series 0, 2, 4, 8, 12, 18...
- Find Nth term of the series 5, 13, 25, 41, 61...
- Program to find the Nth term of the series 3, 20, 63, 144, 230, ……
- Program to find the Nth term of series 5, 10, 17, 26, 37, 50, 65, 82, ...
- Program to find the Nth term of series 0, 4, 14, 30, 51, 80, 114, 154, 200, ...
- Find Nth term of the series 3, 14, 39, 84...
- Program to find the Nth term of the series 0, 14, 40, 78, 124, ...
- Program to find the Nth term of the series 0, 5, 14, 27, 44, ........

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.