Related Articles
Find n-th term of series 2, 10, 30, 68, 130 …
• Last Updated : 25 May, 2021

Given a series 2, 10, 30, 68, 130 … Identify the pattern in the series and find the nth value in the series. Indices are starting from 1 . 1 <= n <= 200
Examples:

```Input : n = 12
Output : 1740

Input : n = 200
Output : 8000200```

If observed carefully, pattern of the series can be noticed as n^3 + n.
Below is the implementation of above approach:

## C++

 `// C++ program to find n-th value``#include ``using` `namespace` `std;` `// Function to find nth term``int` `findValueAtX(``int` `n)``{``    ``return` `(n * n * n) + n;``}` `// drivers code``int` `main()``{``    ``cout << findValueAtX(10) << endl;``    ``cout << findValueAtX(2) << endl;``    ``return` `0;``}`

## Java

 `// Java program to find n-th value``import` `java.io.*;` `class` `GFG {``    ` `    ``// Function to find nth term``    ``static` `int` `findValueAtX(``int` `n)``    ``{``        ``return` `(n * n * n) + n;``    ``}` `    ``// driver code``    ``public` `static` `void` `main(String[] args)``    ``{``        ``System.out.println(findValueAtX(``10``));``        ``System.out.println(findValueAtX(``2``));``    ``}``}` `// This code is contributed by vt_m.`

## Python3

 `# Python3 program to find n-th value` `# Function to find nth term``def` `findValueAtX(n):``    ``return` `(n ``*` `n ``*` `n) ``+` `n` `# Driver Code``print``(findValueAtX(``10``))``print``(findValueAtX(``2``))` `# This code is contributed by Azkia Anam.`

## C#

 `// C# program to find n-th value``using` `System;` `class` `GFG {``    ` `    ``// Function to find nth term``    ``static` `int` `findValueAtX(``int` `n)``    ``{``        ``return` `(n * n * n) + n;``    ``}` `    ``// driver code``    ``public` `static` `void` `Main()``    ``{``        ``Console.WriteLine(findValueAtX(10));``        ``Console.WriteLine(findValueAtX(2));``    ``}``}`

## PHP

 ``

## Javascript

 ``

Output:

```1010
10```

My Personal Notes arrow_drop_up