 GFG App
Open App Browser
Continue

# Find nth term of the series 2, 8, 18, 32, 50, . . . .

Given an integer N, the task is to find the Nth term of the series

2,  8,  18,  32,  50, ….till N terms

Examples:

Input: N = 4
Output: 32

Input: N = 6
Output: 72

Approach:

From the given series, find the formula for Nth term-

1st term = 2 * 1 ^ 2 = 2

2nd term = 2 * 2 ^ 2 = 8

3rd term = 2 * 3 ^ 2 = 18

4th term = 2 * 4 ^ 2 = 32

.

.

Nth term = 2 * N ^ 2

The Nth term of the given series can be generalized as-

TN = 2 * N ^ 2

Illustration:

Input: N = 6
Output: 72
Explanation:
TN= 2 * N ^ 2
= 2 * 6 ^ 2
= 72

Below is the implementation of the above approach-

## C++

 `// C++ program to implement` `// the above approach` `#include ` `using` `namespace` `std;`   `// Function to return nth` `// term of the series` `int` `find_nth_Term(``int` `n) { ``return` `2 * n * n; }`   `// Driver code` `int` `main()` `{` `    ``// Value of N` `    ``int` `N = 6;`   `    ``// function call` `    ``cout << find_nth_Term(N) << endl;` `    ``return` `0;` `}`

## Java

 `// Java program for the above approach` `import` `java.io.*;` `import` `java.lang.*;` `import` `java.util.*;`   `class` `GFG {`   `    ``// Function to return nth` `    ``// term of the series` `    ``static` `int` `find_nth_Term(``int` `n) { ``return` `2` `* n * n; }`   `    ``// Driver code` `    ``public` `static` `void` `main(String[] args)` `    ``{`   `        ``// Value of N` `        ``int` `N = ``6``;`   `        ``// function call` `        ``System.out.println(find_nth_Term(N));` `    ``}` `}`   `// This code is contributed by hrithikgarg03188.`

## Python

 `# Python program to implement` `# the above approach`   `# Find n-th term of series` `# 2, 8, 18, 32, 50...`     `def` `nthTerm(n):`   `    ``return` `2` `*` `n ``*` `n`     `# Driver Code` `if` `__name__ ``=``=` `"__main__"``:`   `    ``# Value of N` `    ``N ``=` `6`   `    ``# function call` `    ``print``(nthTerm(N))`   `# This code is contributed by Samim Hossain Mondal.`

## C#

 `// C# program to implement` `// the above approach` `using` `System;`   `class` `GFG {`   `    ``// Function to return nth` `    ``// term of the series` `    ``static` `int` `find_nth_Term(``int` `n) { ``return` `2 * n * n; }`   `    ``// Driver Code` `    ``public` `static` `void` `Main()` `    ``{`   `        ``// Value of N` `        ``int` `N = 6;`   `        ``// function call` `        ``Console.Write(find_nth_Term(N));` `    ``}` `}`   `// This code is contributed by sanjoy_62.`

## Javascript

 ``

Output

`72`

Time Complexity: O(1)
Auxiliary Space: O(1)

My Personal Notes arrow_drop_up