GCF & LCM Calculator
Find the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of two or more integers.
What Are GCF and LCM?
The greatest common factor (GCF) and least common multiple (LCM) are two ways to describe the relationships between whole numbers.
The greatest common factor (GCF) is the largest positive integer that divides every given number without a remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF).
The least common multiple (LCM) is the smallest positive integer that is a multiple of every given number.
For example, the GCF of 24 and 36 is 12 because 12 is the largest number that divides both numbers evenly. Their LCM is 72 because 72 is the smallest positive number divisible by both 24 and 36.
Use this GCF and LCM calculator to find both results for 2 to 10 positive whole numbers, from 1 to 1,000,000. The results and calculation steps update automatically as you change the inputs.
How to Use the GCF and LCM Calculator
- Enter at least two positive whole numbers.
- Add more numbers if needed, up to a total of 10.
- Read the calculated GCF and LCM, along with the steps used to find them.
Each input must be a whole number between 1 and 1,000,000. Both results update automatically when the inputs change.
How to Calculate the Greatest Common Factor (GCF)
One efficient method for finding the GCF of two positive integers is the Euclidean algorithm. Instead of listing every factor, the algorithm repeatedly divides one number by another and uses the remainder to continue the calculation.
The GCF Formula
For positive integers a and b, where a is greater than or equal to b:
GCF(a, b) = GCF(b, a mod b)
Here, a mod b means the remainder when a is divided by b. Repeat the process until the remainder is zero. The last nonzero divisor is the GCF.
Example: Find the GCF of 24 and 36
First, divide 36 by 24:
36 = 24 × 1 + 12
Next, divide 24 by the remainder, 12:
24 = 12 × 2 + 0
The remainder is now zero, so the last nonzero divisor is 12.
GCF(24, 36) = 12
Finding the GCF of Three or More Numbers
For multiple positive integers, calculate the GCF of two numbers first, then calculate the GCF of that result and the next number.
For three numbers a, b, and c:
GCF(a, b, c) = GCF(GCF(a, b), c)
For example, to find the GCF of 8, 12, and 20:
GCF(8, 12) = 4
GCF(4, 20) = 4
Therefore:
GCF(8, 12, 20) = 4
The same process can be repeated until all input numbers have been included.
How to Calculate the Least Common Multiple (LCM)
The least common multiple can be found by listing multiples, using prime factorization, or applying a formula involving the GCF. The formula is particularly useful for calculating the LCM of two positive integers.
The LCM Formula
For two positive integers a and b:
LCM(a, b) = (a × b) ÷ GCF(a, b)
In other words, multiply the two numbers and divide their product by their greatest common factor.
Example: Find the LCM of 24 and 36
The GCF of 24 and 36 is 12.
Using the formula:
LCM(24, 36) = (24 × 36) ÷ 12
LCM(24, 36) = 864 ÷ 12
LCM(24, 36) = 72
Therefore, 72 is the smallest positive number that is divisible by both 24 and 36.
Finding the LCM of Three or More Numbers
For multiple positive integers, calculate the LCM of two numbers first, then calculate the LCM of that result and the next number.
For three numbers a, b, and c:
LCM(a, b, c) = LCM(LCM(a, b), c)
For example, to find the LCM of 8, 12, and 20:
First, calculate the LCM of 8 and 12:
GCF(8, 12) = 4
LCM(8, 12) = (8 × 12) ÷ 4 = 24
Next, calculate the LCM of 24 and 20:
GCF(24, 20) = 4
LCM(24, 20) = (24 × 20) ÷ 4 = 120
Therefore:
LCM(8, 12, 20) = 120
Continue in the same way when more numbers are included.
GCF and LCM Examples
The following examples show how the results differ depending on the input numbers.
| Input numbers | GCF | LCM |
|---|---|---|
| 24 and 36 | 12 | 72 |
| 8, 12, and 20 | 4 | 120 |
| 7, 13, and 17 | 1 | 1,547 |
| 50 and 12 | 2 | 300 |
| 9, 9, and 9 | 9 | 9 |
When the GCF is 1, the numbers have no common positive factor other than 1. Such numbers are called relatively prime. The GCF and LCM of a set of numbers do not have to be equal, and their relationship depends on the values provided.
When Should You Use GCF vs. LCM?
The GCF and LCM solve different types of problems. Choosing the right one depends on whether you are looking for the largest shared factor or the smallest shared multiple.
Use the GCF when you need to:
- Divide items into the largest possible equal groups without leftovers.
- Find the greatest size of equal groups that can be made from different quantities.
- Simplify a fraction by dividing its numerator and denominator by their greatest common factor.
For example, if you have 24 red items and 36 blue items and want to make identical groups without leftovers, the GCF of 24 and 36 is 12. You can make 12 groups, each containing 2 red items and 3 blue items.
Use the LCM when you need to:
- Find the least common denominator when working with fractions.
- Determine when repeating events with different intervals will occur together.
- Find the smallest positive quantity that is an exact multiple of several numbers.
For example, if one event repeats every 6 minutes and another every 8 minutes, the LCM of 6 and 8 is 24. Assuming both events follow their intervals continuously and start together, they will coincide again after 24 minutes.
The Relationship Between GCF and LCM
For two positive integers, the GCF and LCM are connected by an important identity:
GCF(a, b) × LCM(a, b) = a × b
For example, with 24 and 36:
12 × 72 = 24 × 36 = 864
This relationship can help you check a calculation. If the product of the GCF and LCM does not equal the product of the two input numbers, at least one result is incorrect.
This identity applies directly to two positive integers. For three or more numbers, do not apply the same formula to the overall GCF and LCM without further justification.
Common GCF and LCM Mistakes
Confusing factors with multiples. A factor divides a number evenly, while a multiple is obtained by multiplying a number by an integer. The GCF concerns shared factors; the LCM concerns shared multiples.
Choosing a common factor that is not the greatest. Several numbers may have multiple common factors, but the GCF must be the largest one. For example, 1, 2, 3, 4, 6, and 12 are common factors of 24 and 36 only where they divide both numbers; among them, 12 is the greatest.
Applying the two-number product identity to several numbers. The formula GCF(a, b) × LCM(a, b) = a × b applies to two positive integers. For additional inputs, calculate pairwise as described above.
Entering invalid values. The calculator accepts positive whole numbers from 1 to 1,000,000 and requires at least two inputs. Zero, negative numbers, decimals, and values outside the supported range are not valid inputs.
Frequently Asked Questions
What is the difference between GCF and LCM?
The GCF is the greatest positive integer that divides all the given numbers evenly. The LCM is the smallest positive integer that is a multiple of all the given numbers.
Is GCF the same as GCD or HCF?
Yes. For positive integers, greatest common factor (GCF), greatest common divisor (GCD), and highest common factor (HCF) refer to the same mathematical concept.
How do you find the GCF of three or more numbers?
Find the GCF of the first two numbers, then find the GCF of that result and the next number. Continue until every input number has been included. For example, GCF(8, 12, 20) = GCF(GCF(8, 12), 20) = GCF(4, 20) = 4.
How do you find the LCM of multiple numbers?
Find the LCM of two numbers first, then calculate the LCM of that result and the next number. Repeat until all numbers are included. For example, LCM(8, 12, 20) = LCM(LCM(8, 12), 20) = LCM(24, 20) = 120.
When should I use the GCF instead of the LCM?
Use the GCF when you need the greatest shared factor, such as when dividing items into equal groups or simplifying fractions. Use the LCM when you need the smallest shared multiple, such as when finding a common denominator or comparing repeating intervals.