GCD Calculator
Find the Greatest Common Divisor (GCD) of numbers with step-by-step solutions.
What is the Greatest Common Divisor (GCD)?
The Greatest Common Divisor (GCD), also known as the Greatest Common Factor (GCF) or Highest Common Factor (HCF), is the largest positive integer that divides each of the integers without leaving a remainder.
For example, for the numbers 12 and 18:
- Divisors of 12: 1, 2, 3, 4, 6, 12
- Divisors of 18: 1, 2, 3, 6, 9, 18
- Common divisors: 1, 2, 3, 6
- Greatest Common Divisor: 6
Methods to Find GCD
1. Factoring Method
List all factors of each number and find the largest one that appears in all lists. This method is intuitive but can be slow for large numbers.
2. Prime Factorization Method
Find the prime factorization of each number. The GCD is the product of the common prime factors raised to their lowest power.
Example for 12 and 18:
- 12 = 2 × 2 × 3 = 2² × 3¹
- 18 = 2 × 3 × 3 = 2¹ × 3²
- Common primes with lowest exponents: 2¹ × 3¹ = 6
3. Euclidean Algorithm
This is an efficient method for finding the GCD of two numbers. It is based on the principle that the GCD of two numbers also divides their difference.
Formula: GCD(a, b) = GCD(b, a mod b)
Example for 48 and 18:
- 48 ÷ 18 = 2 remainder 12
- 18 ÷ 12 = 1 remainder 6
- 12 ÷ 6 = 2 remainder 0
- The last non-zero remainder is 6, so GCD is 6.
Applications of GCD
- Simplifying Fractions: Dividing numerator and denominator by their GCD gives the simplified fraction.
- Geometry: Finding the side length of the largest square that can title a rectangle.
- Cryptography: Used in algorithms like RSA encryption.
Frequently Asked Questions
Is GCD and GCF the same?
Yes, Greatest Common Divisor (GCD) and Greatest Common Factor (GCF) refer to the same mathematical concept.
Can the GCD be 1?
Yes, if the numbers share no common factors other than 1, their GCD is 1. Such numbers are called "coprime" or "relatively prime."
Does GCD work for negative numbers?
Yes, but GCD is typically defined as a positive integer. GCD(-a, b) is the same as GCD(a, b).