Skip to content
Related Articles
Find Nth term of the series 3, 14, 39, 84…
• Difficulty Level : Easy
• Last Updated : 15 Mar, 2021

Given a number N. The task is to write a program to find the Nth term in the below series:

3, 14, 39, 84…

Examples:

```Input: 3
Output: 39
For N = 3
Nth term = ( 3*3*3 ) + ( 3*3 ) + 3
= 39

Input: 4
Output: 84```

Formula to calculate the Nth term of the series:

`Nth term = ( N*N*N ) + ( N*N ) + N `

Below is the required implementation:

## C++

 `// CPP program to find N-th term of the series:``// 3, 14, 38, 84...``#include ``using` `namespace` `std;` `// calculate Nth term of series``int` `nthTerm(``int` `N)``{``    ``return` `(N * N * N) + (N * N) + N;``}` `// Driver Function``int` `main()``{``    ``int` `N = 3;` `    ``cout << nthTerm(N);` `    ``return` `0;``}`

## Java

 `// Java program to find Nth number``import` `java.io.*;` `// calculate Nth term of this series``class` `GFG``{``public` `int` `nthTerm(``int` `N)``{``    ``// By using above formula``    ``return` `(N * N * N) + (N * N) + N;``}` `// Driver Code``public` `static` `void` `main(String[] args)``{``    ``int` `N = ``3``;``    ``GFG a = ``new` `GFG();` `    ``// call and print Nth term``    ``System.out.println(a.nthTerm(N));``}``}`

## Python 3

 `# Python 3 program to find  N-th``# term of the series:``# 3, 14, 38, 84...` `# Function to calculate Nth term of series ``def` `nthTerm(n) :` `    ``return` `(N ``*` `N ``*` `N) ``+` `(N ``*` `N) ``+` `N` `# Driver code``if` `__name__ ``=``=` `"__main__"` `:` `     ``N ``=` `3` `     ``# function calling``     ``print``(nthTerm(N))` `# This code is contributed by ANKITRAI1`

## C#

 `// C# program to find Nth number``using` `System;` `// calculate Nth term of this series``class` `GFG``{``public` `int` `nthTerm(``int` `N)``{``    ``// By using above formula``    ``return` `(N * N * N) + (N * N) + N;``}` `// Driver Code``public` `static` `void` `Main()``{``    ``int` `N = 3;``    ``GFG a = ``new` `GFG();` `    ``// call and print Nth term``    ``Console.WriteLine(a.nthTerm(N));``}``}` `// This code is contributed``// by inder_verma.`

## PHP

 ``

## Javascript

 ``
Output:
`39`

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.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with industry experts, please refer DSA Live Classes

My Personal Notes arrow_drop_up