## Number of squares of maximum area in a rectangle

Given a rectangle of sides m and n. Cut the rectangle into smaller identical pieces such that each piece is a square having maximum possible… Read More »

## Program to find LCM of 2 numbers without using GCD

Finding LCM using GCD is explained here but here the task is to find LCM without first calculating GCD. Examples: Input: 7, 5 Output: 35… Read More »

## Number of Distinct Meeting Points on a Circular Road

Consider two cars A and B, running infinitely (either clockwise or anti-clockwise) on a circular road. Given the speed of both the cars a and… Read More »

## LCM of two large numbers

Given two large numbers ‘a’ and ‘b’ such that(10^20<=a, b<=10^300). Find the LCM of two large numbers given. Examples: Input: a = 234516789234023485693020129 b =… Read More »

## Find the GCD that lies in given range

Given two positive integer a and b and a range [low, high]. The task is to find the gretest common divisor of a and b… Read More »

## Subsequence of size k with maximum possible GCD

We are given an array of positive integers and an integer k. Find the maximum possible GCD of a sub sequence of size k. Examples:… Read More »

## Convert the array such that the GCD of the array becomes 1

Given an array of positive elements and a positive integer k, the task is to convert the GCD of the array to 1. To make… Read More »

## Levelwise Alternating GCD and LCM of nodes in Segment Tree

A Levelwise GCD/LCM alternating segment tree is a segment tree, such that at every level the operations GCD and LCM alternate. In other words at… Read More »

## Construct an array from GCDs of consecutive elements in given array

Given an array a[] of n elements. The task is to find the array (say b[]) of n + 1 such that Greatest Common Divisor… Read More »

## Minimum operations to make GCD of array a multiple of k

Given an array and k, we need to find the minimum operations needed to make GCD of the array equal or multiple of k. Here… Read More »

## Array with GCD of any of its subset belongs to the given array

Given a set of N elements such that N, task is to generate an array such that the GCD of any subset of the generated… Read More »

## First N natural can be divided into two sets with given difference and co-prime sums

Given N and M, task is to find whether numbers 1 to N can be divided into two sets such that the absolute difference between… Read More »

## Finding a Non Transitive Coprime Triplet in a Range

Given L and R, find a possible non transitive triplet (a, b, c) such that pair (a, b) is coprime and pair (b, c) is… Read More »

## LCM of factorial and its neighbors

Given a number, we need to find LCM of the factorial of the numbers and its neighbors. If the number is N, we need to… Read More »

## Check if the given two numbers are friendly pair or not

Given two positive integer N, M. The task is to check if N and M are friendly pair or not. In number theory, friendly pairs… Read More »