# Find n-th term in the series 7, 15, 32, …

Given a series 7, 15, 32, …… Find the nth term of this series.

**Examples :**

Input : 5 Output : 138 Input : 7 Output : 568

**Approach : **By seeing the pattern of the series we can easily identify that it is a mixed series.

S = 7, 15, 32…..

Each element in the series is multiplied by 2 and then incremented one more than the previous.

S = 7, 15 (2 * 7 + 1), 32 (2 * 15 + 2)…….

By using iteration we can easily find nth term of the series.

Below is the implementation of the above approach :

## C++

`// CPP program to find nth term ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// utility function ` `int` `findTerm(` `int` `n) ` `{ ` ` ` `if` `(n == 1) ` ` ` `return` `n; ` ` ` ` ` `else` `{ ` ` ` ` ` `// since first element of the ` ` ` `// series is 7, we initailise ` ` ` `// a variable with 7 ` ` ` `int` `term = 7; ` ` ` ` ` `// Using iteration to find nth ` ` ` `// term ` ` ` `for` `(` `int` `i = 2; i <= n; i++) ` ` ` `term = term * 2 + (i - 1); ` ` ` ` ` `return` `term; ` ` ` `} ` `} ` ` ` `// driver function ` `int` `main() ` `{ ` ` ` `int` `n = 5; ` ` ` `cout << findTerm(n); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find nth term ` `import` `java.lang.*; ` ` ` `class` `GFG { ` ` ` `// utility function ` `static` `int` `findTerm(` `int` `n) ` `{ ` ` ` `if` `(n == ` `1` `) ` ` ` `return` `n; ` ` ` ` ` `else` `{ ` ` ` ` ` `// since first element of the ` ` ` `// series is 7, we initailise ` ` ` `// a variable with 7 ` ` ` `int` `term = ` `7` `; ` ` ` ` ` `// Using iteration to find nth ` ` ` `// term ` ` ` `for` `(` `int` `i = ` `2` `; i <= n; i++) ` ` ` `term = term * ` `2` `+ (i - ` `1` `); ` ` ` ` ` `return` `term; ` ` ` `} ` `} ` ` ` `// Driver code ` `public` `static` `void` `main(String[] args) ` `{ ` ` ` `int` `n = ` `5` `; ` ` ` `System.out.print(findTerm(n)); ` `} ` `} ` ` ` `// This code is contributed by Anant Agarwal. ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to find nth term ` ` ` `# utility function ` `def` `findTerm(n) : ` ` ` ` ` `if` `n ` `=` `=` `1` `: ` ` ` `return` `n ` ` ` `else` `: ` ` ` ` ` `# since first element of the ` ` ` `# series is 7, we initailise ` ` ` `# a variable with 7 ` ` ` `term ` `=` `7` ` ` ` ` `# Using iteration to find nth ` ` ` `# term ` ` ` `for` `i ` `in` `range` `(` `2` `, n ` `+` `1` `) : ` ` ` `term ` `=` `term ` `*` `2` `+` `(i ` `-` `1` `); ` ` ` ` ` `return` `term; ` ` ` `# driver function ` `print` `(findTerm(` `5` `)) ` ` ` `# This code is contributed by Saloni Gupta ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find nth term ` `using` `System; ` ` ` `class` `GFG { ` ` ` ` ` `// utility function ` ` ` `static` `int` `findTerm(` `int` `n) ` ` ` `{ ` ` ` `if` `(n == 1) ` ` ` `return` `n; ` ` ` ` ` `else` `{ ` ` ` ` ` `// since first element of the ` ` ` `// series is 7, we initailise ` ` ` `// a variable with 7 ` ` ` `int` `term = 7; ` ` ` ` ` `// Using iteration to find nth ` ` ` `// term ` ` ` `for` `(` `int` `i = 2; i <= n; i++) ` ` ` `term = term * 2 + (i - 1); ` ` ` ` ` `return` `term; ` ` ` `} ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `int` `n = 5; ` ` ` `Console.WriteLine(findTerm(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by vt_m. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find nth term ` ` ` `// utility function ` `function` `findTerm(` `$n` `) ` `{ ` ` ` `if` `(` `$n` `== 1) ` ` ` `return` `$n` `; ` ` ` ` ` `else` ` ` `{ ` ` ` ` ` `// since first element of the ` ` ` `// series is 7, we initailise ` ` ` `// a variable with 7 ` ` ` `$term` `= 7; ` ` ` ` ` `// Using iteration to find nth ` ` ` `// term ` ` ` `for` `(` `$i` `= 2; ` `$i` `<= ` `$n` `; ` `$i` `++) ` ` ` `$term` `= ` `$term` `* 2 + (` `$i` `- 1); ` ` ` ` ` `return` `$term` `; ` ` ` `} ` `} ` ` ` `// Driver Code ` `$n` `= 5; ` `echo` `(findTerm(` `$n` `)); ` ` ` `// This code is contributed by Ajit. ` `?> ` |

*chevron_right*

*filter_none*

**Output :**

138

This article is contributed by **Saloni Gupta **. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

## Recommended Posts:

- Find the Nth term of the series where each term f[i] = f[i - 1] - f[i - 2]
- Find n-th term of series 1, 4, 27, 16, 125, 36, 343 .......
- Find the nth term of the given series
- Find the Nth term of the series 2 + 6 + 13 + 23 + . . .
- Find n-th term in series 1 2 2 3 3 3 4 4 4 4....
- Find n-th term in the series 9, 33, 73,129 ...
- Find nth term of the series 5 2 13 41
- Find Nth term of the series 1, 1, 2, 6, 24...
- Find Nth term of the series 0, 6, 0, 12, 0, 90...
- Find Nth term of the series 1, 8, 54, 384...
- Find Nth term of the series 1, 5, 32, 288 ...
- Find the Nth term of the series 1 + 2 + 6 + 15 + 31 + 56 + ...
- Find n-th term of series 1, 3, 6, 10, 15, 21...
- Find Nth term of the series 3, 14, 39, 84...
- Find n-th term of series 2, 10, 30, 68, 130 ...