The Greatest Common Divisor (GCD), also known as the greatest common factor (GCF) or highest common factor (HCF), of two or more integers, is the largest positive integer that divides each of the integers without leaving a remainder. In simpler terms, it is the largest number that evenly divides two or more numbers.
Find the GCD of 48 and 18:
Start with the two numbers: 48 and 18. Apply the Euclidean algorithm: The algorithm states that GCD(a, b) is the same as GCD(b, a % b) until b equals 0. First iteration: a = 48 b = 18 Calculate a % b: 48 % 18 = 12 Now, set a to 18 and b to 12. Second iteration: a = 18 b = 12 Calculate a % b: 18 % 12 = 6 Now, set a to 12 and b to 6. Third iteration: a = 12 b = 6 Calculate a % b: 12 % 6 = 0 Now, set a to 6 and b to 0. Termination: When b becomes 0, the value of a (which is 6) is the GCD.
The GCD of 48 and 18 is 6.Note: The % symbol in the above explanation represents the modulo operator. It is used in mathematics and programming to find the remainder of dividing one number by another. In the context of the Euclidean algorithm for finding the GCD, the modulo operation helps reduce the numbers' size iteratively.