Given a series 2, 12, 36, 80, 150.. Find the n-th term of the series.

**Examples :**

Input : 2 Output : 12 Input : 4 Output : 80

If we take a closer look, we can notice that series is sum of squares and cubes of natural numbers (1, 4, 9, 16, 25, …..) + (1, 8, 27, 64, 125, ….).

Therefore n-th number of the series is **n^2 + n^3**

## C++

`// CPP program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` `#include <iostream> ` `using` `namespace` `std; ` ` ` `// Returns n-th term of the series ` `// 2, 12, 36, 80, 150 ` `int` `nthTerm(` `int` `n) ` `{ ` ` ` `return` `(n * n) + (n * n * n); ` `} ` ` ` `// driver code ` `int` `main() ` `{ ` ` ` `int` `n = 4; ` ` ` `cout << nthTerm(n); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`//java program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` `import` `java.util.*; ` ` ` `class` `GFG ` `{ ` ` ` `// Returns n-th term of the series ` ` ` `// 2, 12, 36, 80, 150 ` ` ` `public` `static` `int` `nthTerm(` `int` `n) ` ` ` `{ ` ` ` `return` `(n * n) + (n * n * n); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `int` `n = ` `4` `; ` ` ` `System.out.print(nthTerm(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by rishabh_jain ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 code to find n-th term of ` `# the series 2, 12, 36, 80, 150, .. ` ` ` `# Returns n-th term of the series ` `# 2, 12, 36, 80, 150 ` `def` `nthTerm( n ): ` ` ` `return` `(n ` `*` `n) ` `+` `(n ` `*` `n ` `*` `n) ` ` ` `# driver code ` `n ` `=` `4` `print` `( nthTerm(n)) ` ` ` `# This code is contributed ` `# by "Sharad_Bhardwaj". ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Returns n-th term of the series ` ` ` `// 2, 12, 36, 80, 150 ` ` ` `public` `static` `int` `nthTerm(` `int` `n) ` ` ` `{ ` ` ` `return` `(n * n) + (n * n * n); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `int` `n = 4; ` ` ` `Console.WriteLine(nthTerm(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by vt_m. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` ` ` `// Returns n-th term of the series ` `// 2, 12, 36, 80, 150 ` `function` `nthTerm(` `$n` `) ` `{ ` ` ` `return` `(` `$n` `* ` `$n` `) + (` `$n` `* ` `$n` `* ` `$n` `); ` `} ` ` ` `// driver code ` `$n` `= 4; ` `echo` `(nthTerm(` `$n` `)); ` ` ` `// This code is contributed by Ajit. ` `?> ` |

*chevron_right*

*filter_none*

**Output :**

80

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:

- 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
- Sum of series till N-th term whose i-th term is i^k - (i-1)^k
- Program to get the Sum of series: 1 - x^2/2! + x^4/4! -.... upto nth term
- 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 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, ........
- Find Nth term of the series 1, 8, 54, 384...

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.