VOOZH about

URL: https://www.geeksforgeeks.org/dsa/find-nth-term-of-the-series-3-8-15-24/

⇱ Find nth term of the series 3, 8, 15, 24, . . . - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Find nth term of the series 3, 8, 15, 24, . . .

Last Updated : 20 Aug, 2022

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

3, 8, 15, 24, . . .till Nth term

Examples:

Input: N = 5 
Output: 35

Input: N = 6
Output: 48

Approach:

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

1st term  = 1 (1 + 2) = 3

2nd term = 2 (2 + 2) = 8

3rd term =  3 (3 + 2) = 15

4th term =  4 (4 + 2) = 24

.

.

Nth term = N * (N + 2) 

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

TN = N * (N + 2)

Illustration:

Input: N = 5
Output: 35
Explanation:
TN = N * (N + 2)
     = 5 * (5 + 2)
     = 35

Below is the implementation of the above approach-


Output
35

Time Complexity: O(1), since there is no loop or recursion.
Auxiliary Space: O(1) , since no extra space has been taken.

Comment