Definition
What GCF and LCM mean
The greatest common factor (GCF) is the largest positive integer that divides each given positive integer evenly. The least common multiple (LCM) is the smallest positive integer divisible by all of them.
- GCF answers
- What is the largest shared divisor?
- LCM answers
- What is the first positive shared multiple?
- Compare prime powers
- Lowest shared for GCF, highest for LCM
Where GCF and LCM are used
The GCF is what you divide by to simplify a fraction or a ratio: 36/60 has a GCF of 12, so it simplifies to 3/5. It also answers sharing questions, such as the largest equal groups you can make from 24 pencils and 36 erasers with nothing left over (12 groups of 2 pencils and 3 erasers).
The LCM is the lowest common denominator when adding fractions, and it answers timing questions: if one bus comes every 12 minutes and another every 18, they arrive together every LCM(12, 18) = 36 minutes.
How to use the calculator
Type two to twenty whole numbers, separated by commas or spaces. The GCF tab shows the greatest common factor, its prime factors, the prime factorization of every number you entered, and the full list of common factors. With two numbers it also shows each step of Euclid’s algorithm. The LCM tab shows the least common multiple, built from the highest power of every prime.
Every number must be a whole number of 1 or more. Zero is left out on purpose: every number divides zero, so it has no useful GCF, and its LCM with anything is zero.
A worked example with three numbers
Take 24, 36 and 60. Their prime factorizations are 24 = 2³ × 3, 36 = 2² × 3² and 60 = 2² × 3 × 5. The primes found in all three are 2 and 3. The lowest power of 2 is 2² and the lowest power of 3 is 3¹, so GCF = 4 × 3 = 12.
For the LCM, list every prime that appears anywhere (2, 3 and 5) at its highest power: 2³, 3² and 5. LCM = 8 × 9 × 5 = 360. A check: 360 ÷ 24 = 15, 360 ÷ 36 = 10 and 360 ÷ 60 = 6, all whole numbers.
Adding fractions with the LCM
To add 5/12 and 7/18, find a common denominator. The LCM of 12 and 18 is 36, so rewrite both fractions over 36: 5/12 = 15/36 and 7/18 = 14/36. The sum is 29/36. Using the LCM rather than simply multiplying the denominators (12 × 18 = 216) keeps the numbers small and the answer already in lowest terms more often.
The fractions calculator does this automatically and simplifies the result using the GCF.
Three methods compared
Listing factors or multiples is easy to follow and fine for small numbers, but slow for large ones. Prime factorization shows why the answer is what it is, and works for any number of values at once. Euclid’s algorithm is the fastest for two numbers, even very large ones, because each step shrinks the numbers quickly; it is the method computers use.
For two numbers a and b, GCF × LCM = a × b. This does not hold for three or more numbers, which is why the calculator builds the LCM from prime factors instead.
Step-by-step example
Find the GCF and LCM of 24, 36 and 60, then check that each number divides the LCM evenly.
| Step | Result |
|---|---|
| Greatest common factor | 12 |
| Least common multiple | 360 |
| LCM divided by 24 | 15 |
| LCM divided by 36 | 10 |
| LCM divided by 60 | 6 |
Formulas used
GCF = product of shared primes, each at its lowest power
- GCF
- greatest common factor
Example: 24 = 2³ × 3, 36 = 2² × 3², 60 = 2² × 3 × 5, so GCF = 2² × 3 = 12.
LCM = product of every prime that appears, each at its highest power
- LCM
- least common multiple
Example: For 24, 36 and 60: LCM = 2³ × 3² × 5 = 360.
GCF(a, b) = GCF(b, a mod b), until the remainder is 0
LCM(a, b) = a × b ÷ GCF(a, b)
- GCF
- greatest common factor
- LCM
- least common multiple
- a
- first input to the step
- b
- second input to the step
- mod
- remainder after division
Example: 84 and 60: remainders 24, 12, 0, so the GCF is 12 and the LCM is 84 × 60 ÷ 12 = 420.
When the answer can mislead
- A prime that occurs in just one input still belongs in the LCM.
- Multiplying all the inputs can give a common multiple larger than the least one.
- Use positive integers when applying the prime-factor method shown here.
Questions
What is the greatest common factor?
The greatest common factor (GCF) is the largest whole number that divides every number in the list with no remainder. The factors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24; the factors of 36 include 1, 2, 3, 4, 6, 9, 12, 18 and 36. The largest one they share is 12, so GCF(24, 36) = 12. It is also called the greatest common divisor (GCD) or, in the UK, the highest common factor (HCF).
What is the least common multiple?
The least common multiple (LCM) is the smallest positive number that every number in the list divides into. Multiples of 4 are 4, 8, 12, 16 and so on; multiples of 6 are 6, 12, 18 and so on. The first one they share is 12, so LCM(4, 6) = 12. It is the same as the lowest common multiple, and the LCM of denominators is the lowest common denominator.
How do you find the GCF and LCM with prime factors?
Write each number as a product of primes. 24 = 2³ × 3, 36 = 2² × 3² and 60 = 2² × 3 × 5. For the GCF, take only the primes that appear in every number, at their lowest power: 2² × 3 = 12. For the LCM, take every prime that appears, at its highest power: 2³ × 3² × 5 = 360.
Is there a quick way for two numbers?
Yes. Find the GCF with Euclid’s algorithm, then use LCM = a × b ÷ GCF. For 84 and 60: 84 = 1 × 60 + 24, 60 = 2 × 24 + 12, 24 = 2 × 12 + 0, so the GCF is 12 (the last non-zero remainder) and the LCM is 84 × 60 ÷ 12 = 420. The calculator writes out these steps whenever you enter exactly two numbers.
What if the GCF is 1?
Then the numbers are called coprime or relatively prime: they share no prime factors. For two coprime numbers the LCM is simply their product, so LCM(8, 15) = 120. Note that coprime numbers do not have to be prime themselves; 8 and 15 are both composite.
Why does the calculator limit the size of the numbers?
Each number is factored into primes on your device, which takes longer as numbers grow. Up to 1,000,000,000 this is instant. The LCM itself can be far larger, so it is calculated exactly with big-integer arithmetic and shown in full, even when it runs to many digits.
Embed this calculator
Cite this calculator
GCF and LCM Calculator. CalculatorLab. https://calculatorlab.site/calculators/gcf-lcm-calculator/. Last updated . Accessed .