##
Happy Numbers
October 10, 2017

A Happy Number n is defined by the following process. Starting with n, replace it with the sum of the squares of its digits, and… Read More »

October 10, 2017

A Happy Number n is defined by the following process. Starting with n, replace it with the sum of the squares of its digits, and… Read More »

Express a given number as a summation of 4 positive primes. If it is not possible to express then print “-1”. Examples: Input: 24 Output:… Read More »

October 9, 2017

Given an integer n, print m increasing numbers such that the sum of m numbers is equal to n and the GCD of m numbers… Read More »

October 5, 2017

Print the sum of series 13 + 23 + 33 + 43 + …….+ n3 till n-th term. Examples: Input : n = 5 Output… Read More »

September 28, 2017

Given an array of integers. We are required to write a program to print the number of factors of every element of the given array.… Read More »

September 21, 2017

The nth Taxicab number Taxicab(n), also called the n-th Hardy-Ramanujan number, is defined as the smallest number that can be expressed as a sum of… Read More »

September 17, 2017

Betrothed numbers are two positive numbers such that the sum of the proper divisors of either number is one more than (or one plus) the… Read More »

Given a number n, find sum of first natural numbers. Examples: Input : n = 3 Output : 6 Explanation : Note that 1 +… Read More »

September 2, 2017

Given two integers a and b. The problem is to find the number of digits in the product of these two integers. Examples: Input :… Read More »

Given a number n, find sum of first n odd natural numbers. Input : 2 Output : 28 1^3 + 3^3 = 28 Input :… Read More »

September 1, 2017

Given a number n, find sum of first n even natural numbers. Examples: Input : 2 Output : 72 2^3 + 4^3 = 72 Input… Read More »

August 20, 2017

This approach is based on Wilson’s theorem and using the fact that factorial computation can be done easily using DP Wilson theorem says if a… Read More »

August 8, 2017

Given a number, find minimum sum of its factors. Examples: Input : 12 Output : 7 Explanation: Following are different ways to factorize 12 and… Read More »

July 28, 2017

Pell numbers are numbers that are similar to the Fibonacci numbers and are generated by below formula Pn = 2*Pn-1 + Pn-2 with seeds P0… Read More »

July 25, 2017

Given a number of the form 11..1 such that number of digits in it is smaller than 10, find square of the number. Examples: Input… Read More »