Home » Math Calculators » GCD Calculator

GCD Calculator

A GCD (Greatest Common Divisor) calculator is a tool that helps to find the largest positive integer that divides two or more given numbers without leaving a remainder. In other words, it calculates the greatest number that is a factor of two or more numbers. 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.

Enter Information

Enter two numbers to find their greatest common divisor:





Results
Fill the calculator form and click on Calculate button to get result here
Calculation 2
Solution of Example : gcd(12, 18) = gcd(18, 12) = gcd(12, 6) = gcd(6, 0) = 6

What is the Greatest Common Divisor?

The Greatest Common Divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder. In other words, it is the largest positive integer that is a common factor of the given integers. The GCD is also known as the Greatest Common Factor (GCF), Highest Common Factor (HCF), or Highest Common Divisor.

For example, the GCD of 12 and 18 is 6, because 6 is the largest positive integer that divides both 12 and 18 without leaving a remainder. Similarly, the GCD of 15, 25, and 35 is 5, because 5 is the largest positive integer that is a factor of all three numbers.

The GCD is commonly used in mathematical computations, especially in problems related to fractions and simplification of algebraic expressions. It can be calculated using various methods, such as prime factorization, Euclidean algorithm, and continued fractions.

How to Find the Greatest Common Divisor (GCD)?

There are several methods to find the Greatest Common Divisor (GCD) of two or more integers. Here are three common methods:

  1. Prime factorization method:
  • Find the prime factorization of each integer.
  • Identify the common prime factors and their minimum power.
  • Multiply the common prime factors raised to their minimum power to get the GCD.

Example: Find the GCD of 48 and 60.

  • Prime factorization of 48: 2^4 × 3
  • Prime factorization of 60: 2^2 × 3 × 5
  • The common prime factors are 2 and 3, and their minimum power is 2.
  • GCD = 2^2 × 3 = 12.
  1. Euclidean algorithm:
  • Divide the larger integer by the smaller integer and find the remainder.
  • Replace the larger integer with the smaller integer and the smaller integer with the remainder.
  • Repeat the above step until the remainder is 0.
  • The last non-zero remainder is the GCD.

Example: Find the GCD of 48 and 60 using the Euclidean algorithm.

  • 60 ÷ 48 = 1 with a remainder of 12.
  • 48 ÷ 12 = 4 with a remainder of 0.
  • The last non-zero remainder is 12.
  • GCD = 12.
  1. Continued fractions method:
  • Write each integer as a fraction with the other integer as the denominator.
  • Write the continued fraction expansion of the resulting fraction.
  • The GCD is the denominator of the convergent that corresponds to the last term in the continued fraction expansion.

Example: Find the GCD of 48 and 60 using continued fractions.

  • 48/60 = 4/5.
  • Continued fraction expansion of 4/5: [0; 1, 5/4].
  • The last term in the continued fraction expansion is 5/4.
  • The corresponding convergent is 4/5 + 1/(5/4) = 24/20.
  • The denominator of the convergent is 20.
  • GCD = 20.

Note that all three methods give the same result.

What is the Greatest Common Divisor of 0?

Technically speaking, the concept of the Greatest Common Divisor (GCD) is not defined for 0. This is because 0 does not have any positive divisors, and any non-zero number is not a common divisor of 0 with any other number.

In other words, if one of the integers is 0, then the GCD is defined as the absolute value of the other integer. For example, the GCD of 0 and 6 is 6, and the GCD of 0 and -10 is 10.

However, in some contexts, it may be convenient to define the GCD of 0 and a non-zero integer as the absolute value of that integer. This is because the GCD is often used in computations involving fractions, and 0 is the identity element for multiplication. However, this definition is not universally accepted and should be used with caution.