- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Finding n-th term of series 3, 13, 42, 108, 235... in C++

In this problem, we are given a number n. Our task is to *find the n-th term of series 3, 13, 42, 108, 235...*

**Let's take an example to understand the problem,**

Input : 5 Output : 235

## Solution Approach

The series can be represented as the sum of cubes of first n natural numbers. The formula for that is (n^{*}(n+1)/2)2. Also if we add 2^{*} to it we will get the required series.

The formula for sum of the series is (n^{*}(n+1)/2)^{2}+2^{*}n.

For n = 5 sum by the formula is

(5 * (5 + 1 ) / 2)) ^ 2 + 2*5

= (5 * 6 / 2) ^ 2 + 10

= (15) ^ 2 + 10

= 225 + 10

= 235

## Example

Program to illustrate the working of our solution

#include <iostream> using namespace std; int findNthTerm(int N) { return ((N * (N + 1) / 2)*(N * (N + 1) / 2) ) + 2 * N; } int main() { int N = 5; cout<<"The Nth term fo the series n is "<<findNthTerm(N); return 0; }

## Output

The Nth term fo the series n is 235

- Related Articles
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- C++ Programe to find n-th term in series 1 2 2 3 3 3 4
- C++ program to find n-th term of series 3, 9, 21, 41, 71…
- Program to find N-th term of series 3, 5, 33, 35, 53… in C++
- Program to find N-th term of series 1, 3, 12, 60, 360...in C++
- Program to find N-th term of series 2, 4, 3, 4, 15… in C++
- Program to find N-th term of series 3 , 5 , 21 , 51 , 95 , … in C++
- Program to find N-th term of series 3, 12, 29, 54, 87, … in C++
- C Program for N-th term of Geometric Progression series
- C Program for N-th term of Arithmetic Progression series
- n-th term of series 1, 17, 98, 354…… in C++
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- Program to find N-th term of series 0, 2,1, 3, 1, 5, 2, 7, 3...in C++
- Find sum of Series with n-th term as n^2 - (n-1)^2 in C++
- Program to find N-th term in the given series in C++

Advertisements