# Tag Archives: GCD-LCM

## Minimum gcd operations to make all array elements oneNovember 19, 2017

Given an array A[] of size N. You can replace any number in the array with the gcd of that element with any of its… Read More »

## GCD of array is greater than oneNovember 17, 2017

Given an array of n integers. The array is considered best if GCD of all its elements is greater than 1. If the array is… Read More »

## GCD of elements in a given rangeNovember 13, 2017

Given two numbers n and m. Find the biggest integer a(gcd), such that all integers n, n + 1, n + 2, …, m are… Read More »

## GCD of factorials of two numbersNovember 11, 2017

Given two numbers m and n. Find the GCD of the their factorial. Examples: Input : n = 3, m = 4 Output : 6… Read More »

## Co-prime pair with given sum minimum differenceNovember 3, 2017

Co-prime or mutually prime pair are those pair of numbers whose GCD is 1. Given a number n represent the number as the sum of… Read More »

## Number of co-prime pairs in an arrayNovember 2, 2017

Co-prime or mutually prime pair are those pair of numbers whose GCD is 1. Given an array of size n, find number of Co-Prime or… Read More »

## Program to find GCD of floating point numbersOctober 29, 2017

The greatest common divisor (GCD) of two or more numbers, which are not all zero, is the largest positive number that divides each of the… Read More »

## LCM of digits of a given numberOctober 23, 2017

Given a number n, find LCM of its digits. Examples: Input : 397 Output : 63 LCM of 3, 9 and 7 is 63. Input… Read More »

## Pair with maximum GCD from two arraysOctober 22, 2017

Given two arrays of n integers with values of array being small (values never exceed a small number say 100). Find the pair(x, y) which… Read More »

## Check if a number is divisible by all prime divisors of another numberOctober 18, 2017

Given two integers. We need to find if the first number x is divisible by all prime divisors of y. Examples: Input : x =… Read More »

## Least Common Denominator (LCD)October 14, 2017

The lowest Common Denominator or Least Common Denominator is the Least Common Multiple of the denominators of a set of fractions. Common denominator : when… Read More »

## GCD of digits of a given numberOctober 12, 2017

Given a number n, find GCD of its digits. Examples: Input : 345 Output : 1 GCD of 3, 4 and 5 is 1. Input… Read More »

## Series with largest GCD and sum equals to nOctober 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 »

## Check if two numbers are co-prime or notOctober 2, 2017

Two numbers A and B are said to be Co-Prime or mutually prime if the Greatest Common Divisor of them is 1. You have been… Read More »

## Smallest number divisible by n and has at-least k trailing zerosSeptember 21, 2017

Two integers n and k are given. Our task is to print K-rounding of n. K-rounding is the minimum positive integer X, such that x… Read More »