Given an integer N, the task is to count all pairs of divisors of N such that the sum of each pair is coprime with… Read More

# Tag Archives: GCD-LCM

Given an N-ary Tree containing N nodes, values associated with each node and Q queries, where each query contains a single node. The task is… Read More

Given two numbers X and Y, the task is to find the probability that an arbitrary positive divisor of 10X is an integral multiple of… Read More

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 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