Greatest Common Divisor (GCD) is the largest number, which divides all the given integers exactly without leaving any remainder. For two integers (a and b) the greatest common divisor of a and b can be denoted as GCD(a, b).
Some Amazing facts related to GCD are:
- The GCD of any number and zero is the number itself.
- The GCD of any two prime numbers is always 1, as they have no common divisors other than 1.
- GCD follows distributive property. GCD(n x a, n x b) = n x GCD(a, b) where a, n and b are greater than 0. For example GCD(15, 21) = 3 x GCD(5, 7) = 3 x 1 = 3.
- If two numbers have a GCD of 1, they are called coprime or relatively prime.
- If a number divides another, then the number itself is the GCD of the two numbers. For example, the GCD of 18 and 6 is 6.
- GCD is related to LCM by the formula: GCD(a, b)×LCM(a, b) = a × b.
- The GCD of two consecutive numbers in the Fibonacci sequence is always 1. For example, for Fibonacci numbers 21 and 34, GCD(21, 34) = 1.
- To find the GCD of multiple numbers, use GCD(a, b, c) = GCD(GCD(a, b), c).
- The GCD of any number with itself is that number, so GCD(a, a) = a.
- The GCD is based on absolute values, so GCD(−a, b) = GCD(a, b).
- The GCD of and b is equal to the GCD of b and a%b. This is the basis for the popular Euclid Algorithm to find GCD.
- GCD of two polynomials is the polynomial of the highest degree that divides both without a remainder.
- If two numbers are powers of the same base, say a = xm and b = xn, then their GCD is xmin(m,n). For example, GCD(25, 23) = 23.
- GCD of a and b (where both a and b are non-zero), can also be defined as the smallest positive integer d which can be a solution/which can be expressed as a linear combination of a and b in the form d = a*p + b*q, where both p and q are integers
- Extended Euclidean Algorithm (based on the previous fact) not only finds the GCD of two numbers but also provides Bezout's coefficients, which are integers x and y such that a × x + b × y = GCD(a, b).
- For any two consecutive integers, the GCD is always 1. This is because consecutive numbers are always relatively prime. For example, GCD(100, 101) = 1.
- GCD and LCM distribute over each other.
GCD(a, LCM(b, c)) = GCD(LCM(a, b), LCM(a, c)) and
LCM(a, GCD(b, c)) = LCM(GCD(a, b), GCD(a, c))
Read More,