# Tag Archives: GCD-LCM

Given an array arr[] of size N, the task is to find the minimum LCM (Least Common Multiple) of all unique pairs in the given… Read More
Given an integer N, the task is to find all distinct co-prime sets up to the given integer N such that an element doesn’t appear… Read More
Given an integer N, the task is to find the sum of Greatest Common Divisors of all numbers up to N with N itself.Examples: Input:… Read More
Given an integer array arr[] of size N, the task is to find the GCD of LCM of all unique pair (i, j) of the… Read More
Given an integer N, the task is to print any pair of integers that have the sum of GCD and LCM equal to N.Examples: Input:… Read More
Given an array arr[] of length N, the task is the find the length of longest subarray of length at least 2 with maximum possible… Read More
Given an integer N, the task is to create two sets of distinct elements from 1 to N such that the gcd of their respective… Read More
Given two integers, X and K, the task is to find if X2 is divisible by K or not. Here, both K and X can… Read More
Competitive Programming (CP) doesn’t typically require to know high-level calculus or some rocket science. But there are some concepts and tricks which are sufficient most… Read More
Given A numbers of white and B numbers of black balls. You need to have X number of white and Y number of black balls… Read More
Given an array arr of positive integers, the task is to find minimum GCD possible for any pair of the given array.Examples:  Input: arr[] =… Read More
Given a number N, the task is to find the number of pairs (a, b) in the range [1, N] such that their LCM is… Read More
Given two integers M and K, the task is to count the number of integers between [0, M] such that GCD of that integer with… Read More
Given an array arr[] of N numbers. The task is to find the maximum GCD of all subarrays of size greater than 1. Examples:   Input: arr[]… Read More
Given two numbers N and K. A sequence A1, A2, ….AN of length N can be created by placing numbers from 1 to K at… Read More