GCF and LCM

Watch the video explainer

Learning goals

  • Find a GCF and an LCM by listing factors or multiples
  • Compute a GCF and an LCM from prime factorizations, taking the lowest or highest prime power
  • Explain why lowest serves the GCF and highest serves the LCM
  • Apply the product rule for two numbers, and explain why it can fail for three
  • Read greatest number of equal groups as GCF and coinciding cycles as LCM

Common factors and the GCF

A common factor of two positive whole numbers is a number that is a factor of both. Take 1212 and 1818. Their factors are

12:  1,2,3,4,6,1218:  1,2,3,6,9,18.12: \; 1, 2, 3, 4, 6, 12 \qquad\qquad 18: \; 1, 2, 3, 6, 9, 18.

The numbers that appear in both lists are 1,2,3,1, 2, 3, and 66: these are the common factors of 1212 and 1818. Every pair of positive whole numbers shares at least the factor 11, so the list of common factors is never empty. The largest entry in it is the one we care about most.

The greatest common factor (GCF) of two positive whole numbers is the largest number that is a factor of both. For 1212 and 1818 the common factors are 1,2,3,61, 2, 3, 6, and the greatest of these is 66, so

GCF⁡(12,18)=6.\operatorname{GCF}(12, 18) = 6.

Dividing by 66 gives 12÷6=212\div6=2 and 18÷6=318\div6=3. So six identical bags can each hold two apples and three oranges, with nothing left over. No larger number divides both totals. In the next chapter, this same common-factor idea helps simplify fractions.

Common multiples and the LCM

Now flip the question around. A common multiple of two positive whole numbers is a number that is a multiple of both. List a few multiples of 44 and of 66:

4:  4,8,12,16,20,24,28,…6:  6,12,18,24,30,…4: \; 4, 8, 12, 16, 20, 24, 28, \ldots \qquad 6: \; 6, 12, 18, 24, 30, \ldots

The positive numbers shared by the lists start 12,24,36,…12,24,36,\ldots. They keep going without end, so there is no greatest common multiple. The least common multiple (LCM) is the smallest positive common multiple, so

LCM⁡(4,6)=12.\operatorname{LCM}(4,6)=12.

The word “positive” matters: 00 is also a multiple of both numbers, but it is not the LCM. Counting by fours and sixes, 1212 is the first positive place the patterns meet. This makes the LCM useful for repeating events and, later, common denominators in fractions.

The GCF is a factor of the numbers, so it is never bigger than either one. The LCM is a multiple of the numbers, so it is never smaller than either one. For 44 and 66, the GCF is 22, at most as big as the smaller number. The LCM is 1212, at least as big as the larger. If a value you have called the GCF comes out larger than the numbers themselves, you have the two swapped. The same is true if an LCM comes out smaller than those numbers.

The listing method

The listing method finds the answer by comparing lists:

For example, the factors of 88 are 1,2,4,81,2,4,8, and those of 1212 are 1,2,3,4,6,121,2,3,4,6,12. Their common factors are 1,2,41,2,4, so their GCF is 44. The factor 33 does not qualify: it divides 1212 but not 88.

Listing is useful when the numbers are small. With larger numbers the lists can become long, so after practicing it we will use the prime factors instead.

Check your understanding

Using the listing method, what is GCF⁡(16,24)\operatorname{GCF}(16, 24)?

Answer choices

Listing works the same way for the LCM. Write out multiples of each number and watch for the first value that shows up in both lists.

Check your understanding

Using the listing method, what is LCM⁡(6,8)\operatorname{LCM}(6, 8)?

Answer choices

The prime-factorization method

Every whole number greater than 11 has a unique prime factorization. That factorization records exactly how many copies of each prime the number is built from, and those counts are what you need for the GCF and LCM. Start each number in prime-power form. Take 1212 and 1818:

12=22×3,18=2×32.12 = 2^2 \times 3, \qquad 18 = 2 \times 3^2.

Think of each number as a bag of prime factors. The bag for 1212 holds two 22s and one 33; the bag for 1818 holds one 22 and two 33s.

The GCF agrees with the factor lists, and 3636 is the first common multiple of 1212 and 1818. The figure separates shared prime copies from the extra copies each number needs.

Where the GCF and the LCM come fromThe left circle is 12 with prime factors two 2s and one 3; the right circle is 18 with one 2 and two 3s. The overlap holds the shared 2 and 3, whose product 6 is the GCF. All factors together, two 2s and two 3s, give the LCM 36.Where the GCF and the LCM come from12 = 2 x 2 x 318 = 2 x 3 x 3only in 122only in 183shared23GCF = 2 x 3 = 6LCM = 36
The prime factors of 12 and 18. The middle region is the part both numbers share (one 2 and one 3): multiply it for the GCF. Everything in either circle, taken together, is the LCM (two 2s and two 3s).

Why lowest power for the GCF

A common factor can use only the prime copies that both numbers contain.

Why the GCF takes the lowest power of each shared prime#

Take 40=23×540=2^3\times5 and 60=22×3×560=2^2\times3\times5. A common factor can use at most two 22s, because 6060 has only two. Both numbers have one 55, so it can use that too. It cannot use 33, which is missing from 4040. Taking all the shared copies gives 22×5=202^2\times5=20.

The same reasoning works for any two positive whole numbers. For each prime, a common factor cannot use more copies than either number contains. The smaller count is therefore the limit. A prime missing from one number cannot be included at all.

Take every shared prime at that limit. The product divides both numbers, because neither is missing any required copies. Every other common factor uses some or all of those copies, so it divides this product and cannot be larger. This proves that the product is the GCF.

If the numbers share no prime, their only common factor is 11. Such numbers are called coprime (or relatively prime). For example, 88 and 99 are coprime, although neither is prime. If one input is 11, the GCF is 11 too.

Why highest power for the LCM

A common multiple must contain enough prime copies for each number.

Why the LCM takes the highest power of each prime that appears in either number#

Again use 40=23×540=2^3\times5 and 60=22×3×560=2^2\times3\times5. A common multiple needs three 22s to contain 4040‘s factors, one 33 to contain 6060‘s, and one 55, which serves both. Taking exactly these copies gives 23×3×5=1202^3\times3\times5=120, which both numbers divide.

For any two positive whole numbers, compare their counts of each prime. A common multiple needs at least the larger count to contain either number’s factors. Even a prime present in just one number must be included, at its full count there.

Take exactly those required counts. Both numbers divide the resulting product. Every positive common multiple contains at least these copies, so it is a multiple of this product and cannot be smaller. This proves that the product is the LCM.

If one input is 11, the LCM is the other number. The GCF takes what both numbers can supply, so it takes the lower count of each prime. The LCM supplies what either number needs, so it takes the higher count.

Check your understanding

Why must LCM⁡(28,42)\operatorname{LCM}(28,42) contain two copies of 22?

Answer choices

Check your understanding

Why can GCF⁡(28,42)\operatorname{GCF}(28,42) contain only one copy of 22?

Answer choices

Worked example 1 Find the GCF and LCM of 2424 and 3636 from their prime factorizations

Write each number in prime-power form first:

24=23×3,36=22×32.24 = 2^3 \times 3, \qquad 36 = 2^2 \times 3^2.

Go prime by prime. For the prime 22, the two powers are 232^3 and 222^2. For the prime 33, they are 313^1 and 323^2.

For the GCF, take the lower power of each:

GCF⁡(24,36)=22×31=4×3=12.\operatorname{GCF}(24, 36) = 2^2 \times 3^1 = 4 \times 3 = 12.

For the LCM, take the higher power of each:

LCM⁡(24,36)=23×32=8×9=72.\operatorname{LCM}(24, 36) = 2^3 \times 3^2 = 8 \times 9 = 72.

As a check, 1212 divides both 2424 and 3636 (giving 22 and 33), and both 2424 and 3636 divide 7272 (giving 33 and 22).

Check your understanding

Given 20=22×520=2^2\times5 and 30=2×3×530=2\times3\times5, which pair gives their GCF and LCM?

Answer choices

GCF and LCM together: the product rule

Look back at 1212 and 1818. The GCF was 66 and the LCM was 3636, and

GCF⁡(12,18)×LCM⁡(12,18)=6×36=216=12×18.\operatorname{GCF}(12, 18) \times \operatorname{LCM}(12, 18) = 6 \times 36 = 216 = 12 \times 18.

The same holds for any two positive whole numbers aa and bb:

GCF⁡(a,b)×LCM⁡(a,b)=a×b.\operatorname{GCF}(a, b) \times \operatorname{LCM}(a, b) = a \times b.

To see why, picture blocks before comparing prime counts. Split each number into the part it shares with the other and the part it does not. That gives 12=2×612 = 2 \times 6 and 18=6×318 = 6 \times 3, with the shared block 66 in the middle. The GCF is that shared block by itself, and the LCM is all three blocks together. So GCF times LCM uses the shared block twice and each outside block once, and so does 12×1812 \times 18.

Why GCF times LCM equals the productThe left circle is 12 and the right circle is 18. The part only in 12 is 2, the shaded shared middle is 6, and the part only in 18 is 3. The GCF is the shared 6, and the LCM is 2 times 6 times 3, which is 36. Multiplying GCF by LCM uses the shared block twice and each outer block once, exactly as multiplying 12 by 18 does, so both products equal 216.Why GCF times LCM equals the product12 = 2 x 618 = 6 x 3shared6GCFonly in 122only in 183used onceused twiceused onceGCF x LCM = 6 x (2 x 6 x 3) = 21612 x 18 = (2 x 6) x (6 x 3) = 216
GCF times LCM equals the numbers multiplied, seen in blocks. The shaded overlap is the GCF and all three blocks together are the LCM, so GCF times LCM uses 2 once, the shared 6 twice, and 3 once. Writing 12 as 2 times 6 and 18 as 6 times 3 uses exactly those same four factors, so both products come to 216.

Why the GCF and the LCM of two numbers multiply back to the product#

Use 40=23×540=2^3\times5 and 60=22×3×560=2^2\times3\times5. For the prime 22, the counts are three and two: the GCF takes two and the LCM three, totaling all five copies in 40×6040\times60. For 33, the counts are zero and one, so the GCF takes none and the LCM one. For 55, both counts are one, so each answer takes one. Together, the GCF 2020 and the LCM 120120 use the same prime copies as the two original numbers:

20×120=2,400=40×60.20\times120=2{,}400=40\times60.

For any prime in any pair of numbers, there are just two counts to compare. The GCF takes the smaller and the LCM the larger, so together they take both counts. If the counts are equal, both answers take that same count. If one count is zero, the GCF takes none and the LCM takes the nonzero count.

Thus GCF times LCM has the same prime copies as the product of the original numbers. The products are equal. If either input is 11, its GCF with the other is 11 and its LCM is the other number, so the rule holds in that case too.

This gives a handy shortcut. Once you have the GCF, you can get the LCM without listing anything, by dividing the product of the numbers by the GCF:

LCM⁡(a,b)=(a×b)÷GCF⁡(a,b).\operatorname{LCM}(a, b) = (a \times b) \div \operatorname{GCF}(a, b).

For 1212 and 1818 that is (12×18)÷6=216÷6=36(12 \times 18) \div 6 = 216 \div 6 = 36, matching what we found the long way.

Worked example 2 Use the product rule to find LCM⁡(8,36)\operatorname{LCM}(8, 36)

First find the GCF. In prime-power form,

8=23,36=22×32.8 = 2^3, \qquad 36 = 2^2 \times 3^2.

The only shared prime is 22, and the lower power is 222^2, so GCF⁡(8,36)=4\operatorname{GCF}(8, 36) = 4. The prime 33 appears only in 3636, so it is not part of the common factor.

Now apply the product rule instead of listing multiples:

LCM⁡(8,36)=(8×36)÷GCF⁡(8,36)=288÷4=72.\operatorname{LCM}(8, 36) = (8 \times 36) \div \operatorname{GCF}(8, 36) = 288 \div 4 = 72.

The highest-power rule gives the same answer: LCM⁡(8,36)=23×32=8×9=72\operatorname{LCM}(8, 36) = 2^3 \times 3^2 = 8 \times 9 = 72. If you already know the GCF, the product rule finds the LCM without listing anything.

Check your understanding

Given that GCF⁡(15,20)=5\operatorname{GCF}(15, 20) = 5, what is LCM⁡(15,20)\operatorname{LCM}(15, 20) using the product rule?

Answer choices

The power rules extend, but the product rule does not

Take 44, 66 and 1010. Only the prime 22 sits in all three, and the fewest copies any of them holds is one, so GCF⁡(4,6,10)=2\operatorname{GCF}(4, 6, 10) = 2. For the LCM, take the most copies of each prime that appears anywhere. That is two 22s from 44, one 33 from 66 and one 55 from 1010, giving 22×3×5=602^2 \times 3 \times 5 = 60. Both answers check out, since 22 divides all three numbers and all three divide 6060.

The same reasoning works however many numbers you start with. A common factor has to divide all of them, so at each prime it is capped by whichever number holds the fewest copies. A common multiple has to cover all of them, so at each prime it needs enough for whichever number holds the most.

Worked example 3 Find the GCF and LCM of 1818, 4242 and 6363

Write all three in prime-power form:

18=2×32,42=2×3×7,63=32×7.18 = 2 \times 3^2, \qquad 42 = 2 \times 3 \times 7, \qquad 63 = 3^2 \times 7.

Now go prime by prime across all three at once. The prime 22 sits in 1818 and 4242 but not in 6363, since 6363 is odd. The prime 33 sits in all three, as 323^2, 313^1 and 323^2. The prime 77 sits in 4242 and 6363 but not in 1818.

For the GCF, keep only the primes every number has, each at its lowest power. That leaves the prime 33 on its own, and the lowest of its three powers is 313^1:

GCF⁡(18,42,63)=3.\operatorname{GCF}(18, 42, 63) = 3.

The primes 22 and 77 drop out for the same reason an unshared prime drops out with two numbers. The number 6363 has no copy of 22 to give, and 1818 has no copy of 77.

For the LCM, take the highest power of every prime that appears anywhere, which is 212^1, 323^2 and 717^1:

LCM⁡(18,42,63)=2×32×7=2×9×7=126.\operatorname{LCM}(18, 42, 63) = 2 \times 3^2 \times 7 = 2 \times 9 \times 7 = 126.

Check both ends. The GCF divides all three: 18÷3=618 \div 3 = 6, 42÷3=1442 \div 3 = 14, and 63÷3=2163 \div 3 = 21. And all three divide the LCM: 126÷18=7126 \div 18 = 7, 126÷42=3126 \div 42 = 3, and 126÷63=2126 \div 63 = 2. Every division comes out whole.

The product rule does not extend, and 22, 33 and 44 show why. Their GCF is 11 and their LCM is 1212, so the two answers multiply to 1212, while 2×3×4=242 \times 3 \times 4 = 24.

Watch the prime 22 in those three numbers. The number 22 holds one copy, 33 holds none, and 44 holds two. The GCF takes the fewest, none, and the LCM takes the most, two. The middle count, the single copy inside the number 22, is taken by neither, and that missing copy accounts for the difference: 24=12×224 = 12 \times 2. With two numbers there is no middle count to miss.

Check your understanding

For 33, 44, and 66, the GCF is 11 and the LCM is 1212. Why is GCF times LCM only 1212, while 3×4×6=723\times4\times6=72?

Answer choices

The lowest-power and highest-power rules work for two or more positive whole numbers. The product rule is guaranteed for two inputs, but can fail for three or more. With three or more, read the GCF and the LCM straight off the prime powers instead: this shortcut, (a×b)÷GCF⁡(a,b)(a \times b) \div \operatorname{GCF}(a, b), does not carry over to three numbers in the same simple way.

Check your understanding

Given 26=2×1326 = 2 \times 13, 39=3×1339 = 3 \times 13 and 52=22×1352 = 2^2 \times 13, what is GCF⁡(26,39,52)\operatorname{GCF}(26, 39, 52)?

Answer choices

GCF in a word problem: the greatest number of equal groups

Many word problems are GCF or LCM questions about everyday situations. The signal for a GCF problem is that you are splitting things into the greatest possible number of equal groups. The same signal appears when you are finding the biggest size that fits evenly into several totals at once.

Worked example 4 Packing into the greatest number of equal boxes

A baker has 4848 muffins and 6060 cookies. She wants to pack them into identical gift boxes so that every box has the same number of muffins and the same number of cookies. No muffins or cookies may be left over, and she wants to make as many boxes as possible. How many boxes can she make?

Each box gets an equal share of the muffins and an equal share of the cookies. So the number of boxes must divide both 4848 and 6060. The largest such number is the greatest common factor. In prime-power form,

48=24×3,60=22×3×5.48 = 2^4 \times 3, \qquad 60 = 2^2 \times 3 \times 5.

Take the lower power of each shared prime: 222^2 for the prime 22, and 313^1 for the prime 33. The prime 55 is only in 6060, so it drops out.

GCF⁡(48,60)=22×3=12.\operatorname{GCF}(48, 60) = 2^2 \times 3 = 12.

So she can make 1212 boxes. Each box holds 48÷12=448 \div 12 = 4 muffins and 60÷12=560 \div 12 = 5 cookies. Asking for the greatest number of equal groups is the tell that you want the GCF.

Check your understanding

A gym coach has 1818 jump ropes and 2424 cones and wants to set up the greatest possible number of identical stations, using every rope and every cone with none left over. How many stations can she set up?

Answer choices

LCM in a word problem: when patterns coincide

The signal for an LCM problem is that two repeating cycles start together and you want to know when they will next line up. The same signal appears when you want the smallest amount that several given sizes can all build up to exactly.

Worked example 5 When do the two bells ring together again?

At a train station, one bell rings every 88 minutes and another rings every 1212 minutes. They ring together at 9:009{:}00. How many minutes until they next ring at the same time?

The first bell rings at minutes 8,16,24,…8, 16, 24, \ldots (the multiples of 88), and the second at minutes 12,24,36,…12, 24, 36, \ldots (the multiples of 1212). They coincide at any common multiple, and they next coincide at the smallest one, the least common multiple. In prime-power form,

8=23,12=22×3.8 = 2^3, \qquad 12 = 2^2 \times 3.

Take the highest power of each prime: 232^3 for the prime 22, and 313^1 for the prime 33.

LCM⁡(8,12)=23×3=8×3=24.\operatorname{LCM}(8, 12) = 2^3 \times 3 = 8 \times 3 = 24.

So the bells next ring together after 2424 minutes, at 9:249{:}24. Checking: 24÷8=324 \div 8 = 3 rings of the first bell and 24÷12=224 \div 12 = 2 rings of the second, both whole, so 2424 really is a moment they share. Asking when repeating events next coincide is the tell that you want the LCM.

Check your understanding

Two runners start together on a track. One finishes a lap every 66 minutes, the other every 99 minutes. After how many minutes do they next cross the start line at the same time?

Answer choices

In a mixed problem, identify whether the answer must divide the totals or be a multiple of them.

Check your understanding

A youth group has 2828 volunteers and 4242 supply kits. It wants to form identical teams, giving every team the same number of volunteers and the same number of kits with none left over, using as many teams as it possibly can. Which computation finds the number of teams?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (optional)

Around 300 BCE, Euclid recorded a way to find a GCF without prime factorization in Book VII of the Elements. Although the Elements is famous for geometry, Book VII studies whole numbers. His method repeatedly subtracts the smaller number from the larger, keeping the smaller and the difference. For 4848 and 6060, subtracting 4848 leaves 1212; further subtractions lead to two 1212s, revealing the GCF.

Euclid treated 11 as a unit, not as a number. Because of this distinction, he wrote the argument in two parts: one proposition handles pairs whose only common measure is the unit, and the next handles pairs with a larger common measure. Today we call both answers a GCF. The commentary on Book VII, Proposition 2 explains why Euclid needed the two separate statements.

The method had a much later role in secret messages. In their 1978 paper on RSA encryption, Ronald Rivest, Adi Shamir, and Leonard Adleman used an extended version of Euclid’s algorithm to help calculate a public encryption key from secret information. Their original paper describes a system for electronic mail, which was then just emerging.

Your progress

See all your progress →