FREE · INSTANT RESULT · WITH THE FORMULA
Home / Math / GCD and LCM Calculator
Math · GCD and LCM

GCD and LCM Calculator

Find the greatest common divisor (GCD) and least common multiple (LCM) of two integers.

GCD
12
LCM
72
LCM = a × b ÷ GCD

TL;DR: A GCD and LCM calculator instantly finds the greatest common divisor and least common multiple for a set of integers.

  • Greatest Common Divisor (GCD): The largest positive integer that divides each of the numbers without a remainder. Also known as the Greatest Common Factor (GCF).
  • Least Common Multiple (LCM): The smallest positive integer that is a multiple of all the numbers in the set.
  • Key Formula: The relationship between the two is defined by the formula: LCM(a, b) = |a × b| / GCD(a, b).
  • Calculation Methods: Common manual methods include prime factorization and the Euclidean algorithm.
  • Calculator Functions: Many scientific calculators, like those from Casio and Texas Instruments, have built-in functions to compute GCD and LCM directly.

What Are the GCD and LCM?

The Greatest Common Divisor (GCD) is the largest positive integer that divides a set of integers without leaving a remainder. For example, the GCD of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 evenly. The term Greatest Common Factor (GCF) is an alternative name for the same concept.

The Least Common Multiple (LCM) is the smallest positive integer that is a multiple of every integer in a given set. For the numbers 4 and 6, the LCM is 12, as 12 is the smallest positive number that both 4 and 6 can divide into. An online GCD and LCM calculator automates the process of finding these values, which is useful for simplifying fractions or solving problems involving time and distance.

How to Calculate the Greatest Common Divisor (GCD)

The GCD of two or more numbers can be calculated using several methods, with prime factorization and the Euclidean algorithm being the most common. The prime factorization method involves breaking down each number into its prime factors and multiplying the common factors together.

Prime Factorization Method for GCD(12, 18):

  • Step 1: Find the prime factors of each number.
  • 12 = 2 × 2 × 3
  • 18 = 2 × 3 × 3
  • Step 2: Identify the common prime factors.
  • Both numbers share one factor of 2 and one factor of 3.
  • Step 3: Multiply these common factors together.
  • GCD = 2 × 3 = 6

The Euclidean algorithm is a more efficient method for larger numbers. It involves repeatedly dividing the larger number by the smaller number and replacing the larger number with the remainder until the remainder is 0. The last non-zero remainder is the GCD.

How to Calculate the Least Common Multiple (LCM)

The LCM can be found using the prime factorization of the numbers or by using a formula that involves their GCD. The prime factorization method requires finding all prime factors for each number, then multiplying the highest power of each unique prime factor present in any of the factorizations.

Prime Factorization Method for LCM(12, 18):

  • Step 1: Find the prime factors of each number.
  • 12 = 2² × 3¹
  • 18 = 2¹ × 3²
  • Step 2: Identify the highest power of each prime factor present in either factorization.
  • The highest power of 2 is 2².
  • The highest power of 3 is 3².
  • Step 3: Multiply these highest powers together.
  • LCM = 2² × 3² = 4 × 9 = 36

A faster method, especially if the GCD is already known, uses a specific formula. This relationship is fundamental in number theory.

How to Find LCM Using GCD

The LCM of two numbers can be calculated directly from their GCD using the formula: LCM(a, b) = |a × b| / GCD(a, b). This formula states that the Least Common Multiple is the absolute value of the product of the two numbers divided by their Greatest Common Divisor. This method is often the quickest way to find the LCM once the GCD has been determined.

For example, to find the LCM of 12 and 18, first find their product and their GCD.

  • Product: 12 × 18 = 216
  • GCD: GCD(12, 18) = 6
  • Calculation: LCM(12, 18) = 216 / 6 = 36

GCD vs. LCM: Key Differences

The GCD and LCM are related but serve opposite functions in mathematics. The GCD is the largest factor shared by numbers, while the LCM is the smallest multiple they share. This means the GCD will always be less than or equal to the smallest number in the set, whereas the LCM will always be greater than or equal to the largest number.

FeatureGreatest Common Divisor (GCD)Least Common Multiple (LCM)
DefinitionThe largest number that divides all integers in a set.The smallest number that is a multiple of all integers in a set.
ValueAlways less than or equal to the smallest number.Always greater than or equal to the largest number.
Primary UseSimplifying fractions, factoring polynomials.Finding a common denominator, solving scheduling problems.
FormulaFound via prime factors or Euclidean algorithm.Can be found using the formula: (a × b) / GCD(a, b)

Using a Scientific Calculator for GCD and LCM

Many scientific calculators have built-in functions to compute GCD and LCM, which eliminates the need for manual calculation. The specific buttons and menu locations vary by brand and model, but the process is generally straightforward. Typically, you access the function through a math or number theory menu.

For example, on many Texas Instruments calculators (like the TI-84 Plus), you can find gcd( and lcm( in the MATH menu under the NUM tab. On certain Casio models, these functions might be accessed using the Alpha key combined with the multiplication or division keys. Always consult your calculator's manual for the exact steps to locate and use these mathematical functions.

Frequently Asked Questions

How do you get LCM from GCD? You can calculate the LCM of two numbers, "a" and "b", by using the formula LCM(a, b) = |a × b| / GCD(a, b). Simply multiply the two numbers together and divide the result by their Greatest Common Divisor.

What is the rule for GCD and LCM? The fundamental rule connecting GCD and LCM for two positive integers "a" and "b" is that their product equals the product of the numbers themselves: GCD(a, b) × LCM(a, b) = a × b.

Is GCF the same as GCD? Yes, GCF (Greatest Common Factor) is the exact same concept as GCD (Greatest Common Divisor). The terms are used interchangeably, with GCD being more common in higher mathematics and GCF often used in primary and secondary school education.

Can you find the GCD and LCM for more than two numbers? Yes, you can find the GCD and LCM for a set of three or more numbers. To do this, you can apply the methods sequentially. For example, GCD(a, b, c) = GCD(GCD(a, b), c).