##
Find minimum sum of factors of number
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 »

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 »

July 12, 2017

Given a number n. We need find the number of ordered pairs of a and b such gcd(a, b) is b itself Examples: Input :… Read More »

July 2, 2017

Questions based on various concepts of number theory and different types of number are quite frequently asked in programming contests. In this article, we discuss… Read More »

June 29, 2017

Given three integers a, b and m. Find an integer k such that where a and m are relatively prime. If it is not possible… Read More »

June 26, 2017

Euler Totient Function (ETF) Φ(n) for an input n is count of numbers in {1, 2, 3, …, n} that are relatively prime to n,… Read More »

June 20, 2017

Given a number N. You are tasked with finding the smallest number S, such that N is a factor of S! (S factorial). N can… Read More »

June 19, 2017

Given two numbers N and K. We need to find out if ‘N’ can be written as sum of ‘K’ prime numbers. Given N <=… Read More »

June 7, 2017

Given a number n, we need to calculate the sum of divisors of factorial of the number. Examples: Input : 4 Output : 60 Factorial… Read More »

May 22, 2017

We have already been introduced to primality testing in the previous articles in this series. Primality Test | Set 1 (Introduction and School Method) Primality… Read More »

May 4, 2017

Given three numbers n, r and p, compute value of nCr mod p. Here p is a prime number greater than n. Here nCr is… Read More »

April 29, 2017

In most of the programming competitions, problems are required to answer the result in 10^9+7 modulo. The reason behind this is to have problems for… Read More »

April 22, 2017

RSA algorithm is asymmetric cryptography algorithm. Asymmetric actually means that it works on two different keys i.e. Public Key and Private Key. As the name… Read More »

March 21, 2017

Given a number n, find all generators of cyclic additive group under modulo n. Generator of a set {0, 1, … n-1} is an element… Read More »