Skip to content

Tag Archives: GCD-LCM

Given a number x, the task is to find first natural number i whose factorial is divisible by x.Examples :   Input : x = 10… Read More
Given a matrix of n rows and m columns. The task is to replace each matrix element with Greatest Common Divisor of its row or… Read More
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
Given two coordinates (x, y) and (a, b). Find if it is possible to reach (x, y) from (a, b). Only possible moves from any coordinate… Read More
Given a number N, the task is to find out maximum sum of distinct numbers such that the Least Common Multiple of all these numbers… Read More
Given a number n such that 1 <= N <= 10^6, the Task is to Find the LCM of First n Natural Numbers.  Examples:  Input… Read More
Given an array arr[] such that 1 <= arr[i] <= 10^12, the task is to find prime factors of LCM of array elements. Examples:  Input… Read More
Given three integers x, y, z, the task is to compute the value of GCD(LCM(x,y), LCM(x,z)). Where, GCD = Greatest Common Divisor, LCM = Least Common… Read More
Given a number n find the smallest number evenly divisible by each number 1 to n.Examples:   Input : n = 4 Output : 12 Explanation… Read More
Given two integer numbers, the task is to find the count of all common divisors of given numbers. Input : a = 12, b =… Read More
Given two integer numbers, the task is to find the count of all common divisors of given numbers? Input : a = 12, b =… Read More
You are given two positive numbers M and N. The task is to print greatest common divisor of M’th and N’th Fibonacci Numbers.The first few… Read More
Stein’s algorithm or binary GCD algorithm is an algorithm that computes the greatest common divisor of two non-negative integers. Stein’s algorithm replaces division with arithmetic… Read More
Given an array of n numbers, find LCM of it.   Input : {1, 2, 8, 3} Output : 24 Input : {2, 7, 3, 9,… Read More
Given an array arr[] of n numbers and an integer k, find length of the minimum sub-array with gcd equals to k.Example:  Input: arr[] =… Read More