Category Archives: Mathematical

GCD of two numbers formed by n repeating x and y times

Given three positive integer n, x, y. The task is to print Greatest Common Divisor of numbers formed by n repeating x times and number… Read More »

Count natural numbers whose factorials are divisible by x but not y

Given two numbers x and y (x <= y), find out the total number of natural numbers, say i, for which i! is divisible by… Read More »

Find the first natural number whose factorial is divisible by x

Given a number x, the task is to find first natural number i whose factorial is divisible by x. Input : x = 10 Output… Read More »

Find two prime numbers with given sum

Given an even number (greater than 2 ), print two prime numbers whose sum will be equal to given number. There may be several combinations… Read More »

Count numbers with same first and last digits

Given an interval, the task is to count numbers which have same first and last digits. For example, 1231 has same first and last digits.… Read More »

Right-Truncatable Prime

A Right-truncatable prime is a prime which remains prime when the last (“right”) digit is successively removed. For example, 239 is right-truncatable prime since 239,… Read More »

Program for Chocolate and Wrapper Puzzle

Given following three values, the task is to find the total number of maximum chocolates you can eat. money : Money you have to buy… Read More »

Super Prime

Super-prime numbers (also known as higher order primes) are the subsequence of prime numbers that occupy prime-numbered positions within the sequence of all prime numbers.… Read More »

Mersenne Prime

Mersenne Prime is a prime number that is one less than a power of two. In other words, any prime is Mersenne Prime if it… Read More »

Find sum of modulo K of first N natural number

Given two integer N ans K, the task is to find sum of modulo K of first N natural numbers i.e 1%K + 2%K +… Read More »

Nth character in Concatenated Decimal String

If all decimal numbers are concatenated in a string then we will get a string which looks like string P as shown below. We need… Read More »

Find the highest occurring digit in prime numbers in a range

Given a range L to R, the task is to find the highest occurring digit in prime numbers lie between L and R (both inclusive).… Read More »

Smallest number to multiply to convert floating point to natural

Given a positive floating point number n, the task is to find the smallest integer k, such that when we multiply k with n, we… Read More »

Generate all palindromic numbers less than n

Find all numbers less than n, which are palindromic. Numbers can be printed in any order. Examples: Input : n = 12 Output : 1,… Read More »

Number of sextuplets (or six values) that satisfy an equation

Given an array of n elements. The task is to find number of sextuplets that satisfy the below equation such that a, b, c, d,… Read More »