Greatest Common Divisor (GCD/GSD) Calculator
Calculate the greatest common divisor (GCD), also known as greatest common factor (GCF) or greatest shared divisor (GSD), for multiple numbers.
Calculate Your Greatest Common Divisor (GCD/GSD) Calculator
The Greatest Common Divisor (GCD), also known as Greatest Common Factor (GCF) or Greatest Shared Divisor (GSD), is the largest positive integer that divides each of the given integers without a remainder.
What is the Greatest Common Divisor (GCD)?
The Greatest Common Divisor (GCD), also called the Greatest Common Factor (GCF) or Greatest Shared Divisor (GSD), is the largest positive integer that divides each of a set of numbers without a remainder. It represents the largest factor that the numbers have in common.
For example, the GCD of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 without leaving a remainder.
What is the Least Common Multiple (LCM)?
The Least Common Multiple (LCM) of a set of numbers is the smallest positive number that is divisible by each of the numbers in the set without a remainder. It represents the smallest multiple that all the numbers share.
For example, the LCM of 4 and 6 is 12, because 12 is the smallest number that is divisible by both 4 and 6.
Methods for Calculating GCD
Euclidean Algorithm
The Euclidean Algorithm is an efficient method for computing the GCD based on the principle that if a and b are two positive integers, then gcd(a, b) = gcd(b, a mod b). It repeatedly applies the division algorithm until the remainder becomes zero.
gcd(a, b) = gcd(b, a mod b)
gcd(a, 0) = a
Prime Factorization Method
Another way to find the GCD is through prime factorization. You can find the GCD of two or more numbers by:
- Finding the prime factorization of each number
- Identifying the common prime factors
- Multiplying the common prime factors, each raised to the minimum power it appears in any of the factorizations
For example, to find the GCD of 48 and 180:
48 = 24 × 31
180 = 22 × 32 × 51
Common factors: 2min(4,2) × 3min(1,2) = 22 × 31 = 12
Methods for Calculating LCM
Using GCD
The LCM can be calculated using the GCD with the following formula:
lcm(a, b) = (a × b) ÷ gcd(a, b)
Prime Factorization Method
The LCM can also be found using prime factorization:
- Find the prime factorization of each number
- Take each prime factor that appears in any of the factorizations
- For each prime factor, use the highest power it appears in any of the factorizations
- Multiply all these prime powers together
For example, to find the LCM of 12 and 18:
12 = 22 × 31
18 = 21 × 32
LCM = 2max(2,1) × 3max(1,2) = 22 × 32 = 36
Applications of GCD and LCM
GCD Applications
- Simplifying fractions to their lowest terms
- Finding the common denominators in fraction arithmetic
- Solving Diophantine equations of the form ax + by = c
- Cryptography, especially in the RSA algorithm
- Computer graphics for scaling and alignment
LCM Applications
- Finding common denominators when adding or subtracting fractions
- Calculating when periodic events will coincide
- Optimizing schedules and rotations
- Determining the size of equal groups or portions
- Finding repeating patterns in sequences or designs
Relationship Between GCD and LCM
There is an important relationship between the GCD and LCM of two numbers:
gcd(a, b) × lcm(a, b) = a × b
This relationship shows that if you know the GCD of two numbers, you can easily calculate their LCM, and vice versa.
How to Use This Calculator
- Enter two or more positive integers in the input fields
- Use the "Add Another Number" button if you need to calculate the GCD or LCM of more than two numbers
- Select the "GCD / GSD" tab to calculate the greatest common divisor
- Select the "LCM" tab to calculate the least common multiple
- Click the "Calculate" button to see the result
- The calculator will show not only the GCD or LCM but also the prime factorization of each number and other relevant information
Frequently Asked Questions
Share This Calculator
Found this calculator helpful? Share it with your friends and colleagues!