Sudhir sharma has Published 1149 Articles

C++ program to find Nth term of the series 0, 2, 4, 8, 12, 18…

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:20:47

366 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 0, 2, 4, 8, 12, 18…Let’s take an example to understand the problem, InputN = 5Output12Solution ApproachA simple approach to solve the problem is the formula for the ... Read More

C++ program to find Nth term of series 1, 4, 15, 72, 420…

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:19:57

436 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 1, 4, 15, 72, 420…Let’s take an example to understand the problem, InputN = 4Output72Solution ApproachA simple approach to solve the problem is the formula for the Nth ... Read More

Find Nth term (A matrix exponentiation example) in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:17:32

226 Views

In this problem, we are given an integer N and a recursive function that given Nth term as a function of other terms. Our task is to create a program to Find Nth term (A matrix exponentiation example).The function isT(n) = 2*( T(n-1) ) + 3*( T(n-2) ) Initial values ... Read More

Find Nth positive number whose digital root is X in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:15:37

154 Views

In this problem, we are given two integer values N and X. Our task is to create a program to Find Nth positive number whose digital root is X.Digital Root (X) is a single digit positive number which is found by adding digits of N recursively adding digits, till the ... Read More

C++ program to find Nth number of the series 1, 6, 15, 28, 45, …..

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:10:39

282 Views

In this problem, we are given an integer value N. Our task is to create a program to Find Nth number of the series 1, 6, 15, 28, 45, …In the series, every element is 2 less than the mean of the previous and next element.Let’s take an example to ... Read More

Find nth Hermite number in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:09:30

139 Views

In this problem, we are given an integer value N. Our task is to create a program to Find nth Hermite number.Hermite Number is a number is the value of hermite number when there are 0 arguments.Nth hermite Number is HN = (-2) * (N - 1) * H(N-2) The ... Read More

Find Next Sparse Number in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:06:17

361 Views

In this problem, we are given an integer value N. our task is to create a program to find the next spares Number.Sparse Number is a special type of number whose binary conversion does not contain any adjacent 1’s.Example: 5(101) , 16(10000)Problem Description − For the given number N, we ... Read More

Find next Smaller of next Greater in an array in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:03:33

361 Views

In this problem, we are given an array arr[] consisting of n integer values. Our task is to Find the next Smaller of the next Greater in an array.Problem Description − We will find an element greater than the current element in the array and then we will be finding ... Read More

Find next right node of a given key in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 13:00:02

250 Views

In this problem, we are given a binary Tree BT and a key value. Our task is to Find next right node of a given key.Binary Tree is a special data structure used for data storage purposes.Let’s take an example to understand the problem, Inputkey = 4Output5ExplanationThe element next to ... Read More

Find next palindrome prime in C++

sudhir sharma

sudhir sharma

Updated on 13-Mar-2021 12:37:34

278 Views

In this problem, we are given an element N. We need to find the next palindrome prime.Problem Description − We need to find the smallest prime number which is also a palindrome number, greater than N.Palindrome Number is a number in which the numbers are the same in both directions.Prime ... Read More

Advertisements