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:

  1. Finding the prime factorization of each number
  2. Identifying the common prime factors
  3. 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:

  1. Find the prime factorization of each number
  2. Take each prime factor that appears in any of the factorizations
  3. For each prime factor, use the highest power it appears in any of the factorizations
  4. 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

  1. Enter two or more positive integers in the input fields
  2. Use the "Add Another Number" button if you need to calculate the GCD or LCM of more than two numbers
  3. Select the "GCD / GSD" tab to calculate the greatest common divisor
  4. Select the "LCM" tab to calculate the least common multiple
  5. Click the "Calculate" button to see the result
  6. 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

There is no difference between GCD (Greatest Common Divisor) and GSD (Greatest Shared Divisor). They are different names for the same mathematical concept - the largest positive integer that divides each of the given integers without a remainder. This concept is also sometimes called the Greatest Common Factor (GCF) or Highest Common Factor (HCF).

To find the GCD of multiple numbers, you can apply the Euclidean algorithm repeatedly. First, find the GCD of the first two numbers, then find the GCD of that result and the third number, and continue this process until all numbers are included. Alternatively, you can use the prime factorization method by finding the prime factorization of each number and taking the product of the common prime factors, each raised to the minimum power it appears in any of the factorizations.

The product of the GCD and LCM of two numbers equals the product of the two numbers themselves. This is expressed by the formula: GCD(a, b) × LCM(a, b) = a × b. This relationship allows you to easily find the LCM if you know the GCD, or vice versa, using the formula LCM(a, b) = (a × b) ÷ GCD(a, b).

No, the GCD of a set of numbers cannot be larger than the smallest number in the set. By definition, the GCD must divide all the numbers without a remainder, so it cannot be larger than any of the numbers. The GCD can be equal to the smallest number if that number divides all other numbers in the set.

The GCD of two different prime numbers is always 1, because prime numbers have no common factors except 1. This makes them coprime or relatively prime to each other. For example, the GCD of 7 and 11 is 1. However, the GCD of a prime number with itself is the number itself (e.g., GCD(7, 7) = 7).

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), where 'a mod b' is the remainder when a is divided by b. The algorithm repeatedly applies this step until the remainder becomes zero, at which point the last non-zero remainder is the GCD. For example, to find GCD(48, 18): 48 ÷ 18 = 2 remainder 12, 18 ÷ 12 = 1 remainder 6, 12 ÷ 6 = 2 remainder 0. Since the remainder is now 0, the last non-zero remainder, 6, is the GCD.

When the GCD of two numbers is 1, it means that the numbers have no common factors other than 1. These numbers are called coprime or relatively prime. Coprime numbers play important roles in various mathematical concepts, including in number theory and cryptography. For example, in the RSA encryption algorithm, choosing coprime numbers is a crucial step.

To simplify a fraction to its lowest terms, divide both the numerator and denominator by their GCD. For example, to simplify 24/36: Find the GCD of 24 and 36, which is 12. Divide both numbers by 12: 24 ÷ 12 = 2 and 36 ÷ 12 = 3. The simplified fraction is 2/3. This always results in the simplest form of the fraction where the numerator and denominator share no common factors.

Share This Calculator

Found this calculator helpful? Share it with your friends and colleagues!