This site is a work in progress. New lessons are added regularly. Contact us

GCF and LCM

Learning goals

  • Find a GCF and an LCM by listing factors or multiples
  • Take the lowest power of each shared prime for the GCF
  • Collect the highest power of every prime for the LCM
  • Explain why lowest serves the GCF and highest serves the LCM
  • Apply the product rule for two numbers, and say why three break it
  • Read largest equal groups as GCF and coinciding cycles as LCM

Common factors and the GCF

A common factor of two 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 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 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.

This is the largest number you could divide both 1212 and 1818 by and still land on whole numbers: 12÷6=212 \div 6 = 2 and 18÷6=318 \div 6 = 3. That is exactly what makes the GCF useful. When you reach fractions in the next chapter, you will divide the top and bottom of a fraction by their GCF. That is what reduces the fraction as far as it will go in a single step.

Common multiples and the LCM

Now flip the question around. A common multiple of two 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 numbers in both lists, 12,24,36,12, 24, 36, \ldots, are the common multiples of 44 and 66. Unlike common factors, there are infinitely many of them, because you can always go further out and find more. But there is a smallest one, and that is the one worth naming.

The least common multiple (LCM) of two numbers is the smallest number (other than 00) that both numbers divide into evenly. The common multiples of 44 and 66 start 12,24,36,12, 24, 36, \ldots, so

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

This is the soonest the two counting patterns line up: count by fours and by sixes, and 1212 is the first place they meet. That is why the LCM is the natural common denominator when you add fractions later: it is the smallest number into which both denominators fit.

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 lists above are the listing method (writing the factors or the multiples out and reading the answer off the lists), and they always work:

Listing is reliable and easy to picture, which makes it the right way to meet these ideas. Its drawback shows up with bigger numbers. The factor lists get long, and you might count out a great many multiples before the lists finally meet. For 88 and 3636 you would list multiples up to 7272 before they coincide. So we want a method that does not depend on the numbers being small, and prime factorization provides exactly that.

Before leaving the listing method, it is worth running it once from start to finish. Write out the factors of each number, then read off the ones that appear in both lists:

8:  1,2,4,812:  1,2,3,4,6,12.8: \; 1, 2, 4, 8 \qquad\qquad 12: \; 1, 2, 3, 4, 6, 12.

The numbers in both lists are 11, 22 and 44, so those are the common factors of 88 and 1212. The largest of them is 44, so GCF(8,12)=4\operatorname{GCF}(8, 12) = 4. Notice what disqualifies a number like 33: it divides 1212 but not 88, so it appears in one list and not the other. A factor has to survive both lists to count as a common one.

Check your understanding

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

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. That bookkeeping is precisely what the GCF and LCM need. 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. With the numbers written this way, both answers come from one simple rule each.

Both agree with the lists (GCF=6\operatorname{GCF} = 6 from before, and 3636 is indeed the first common multiple of 1212 and 1818). The figure below shows why “lowest” and “highest” are the right choices. The figure sets the shared core that sits inside both numbers against the combined pile that contains each number whole.

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

The rule is not arbitrary. A factor of both numbers can only use prime copies that both numbers actually own, and that limit is what forces “lowest power.”

Press on the bags for 1212 and 1818 to see the limit bite. A common factor may carry one 22, since both bags hold one. It may not carry two, because 1818 has a single 22 to give. Nothing divides 1818 by asking for copies 1818 does not have. The 33s are capped from the other side, where 1212 holds only one. Take each shared prime at its cap and you have built 2×3=62 \times 3 = 6, the GCF.

So the GCF is built only from the primes the two numbers truly have in common. Each of those primes is capped at the count in whichever number is poorer in that prime. Take a prime to a higher power than that, and the result would no longer divide the poorer number.

Why highest power for the LCM

The LCM argument is the mirror image. A multiple of both numbers must contain enough copies of each prime to cover each number on its own. That is what forces “highest power.”

Hold 1212 and 1818 up to that demand. A common multiple has to hold two 22s, because 1212 does and every multiple of 1212 carries its factors along. It has to hold two 33s for the same reason on the 1818 side. Two of each satisfies both demands at once, and 22×32=362^2 \times 3^2 = 36 is what the demands come to.

Side by side, the two rules are easy to remember once you see the reason. The GCF can only keep what both numbers can spare, so it takes the lower power. The LCM must satisfy whichever number is hungrier for a given prime, so it takes the higher power.

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). So the answers behave exactly as a GCF and an LCM should.

Check your understanding

Given 20=22×520 = 2^2 \times 5 and 30=2×3×530 = 2 \times 3 \times 5, what is LCM(20,30)\operatorname{LCM}(20, 30)?

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.

That is not a coincidence of this one pair. 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.

The reason lives in the prime powers again. Look at the prime 22 in 1212 and 1818. There are two of them in 1212 and one in 1818. The GCF takes the one and the LCM takes the two, so between them the two answers take all three. Multiplying 1212 by 1818 takes all three as well.

That happens at every prime, because a prime is offered just two counts, one from each number. The GCF takes the smaller and the LCM takes the larger, so between them they take both. The two counts can also be equal, as the 55s are in 4040 and 6060. Then each answer takes one of the pair, and the tally comes out the same.

The same bookkeeping is easier to see with blocks than with exponents. 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 the GCF times the LCM calls on the shared block twice and each outside block once, which is exactly what 12×1812 \times 18 does.

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.

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 same answer falls out of the highest-power rule: LCM(8,36)=23×32=8×9=72\operatorname{LCM}(8, 36) = 2^3 \times 3^2 = 8 \times 9 = 72. Either route works, and the product rule is quickest once the GCF is in hand.

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.

Nothing there was special to three numbers. 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. Just more columns to compare.

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, which is exactly what a GCF and an LCM are for.

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 is the whole gap: 24=12×224 = 12 \times 2. With two numbers there is no middle count to miss.

The lowest-power and highest-power rules work for any number of numbers, but the product rule works only for two. With three or more, read the GCF and the LCM straight off the prime powers instead, because the shortcut (a×b)÷GCF(a,b)(a \times b) \div \operatorname{GCF}(a, b) has no three-number version.

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: largest equal groups

Word problems hide the GCF and LCM behind everyday situations. The signal for a GCF problem is that you are splitting things into the largest possible 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 largest 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 the boxes to hold as much 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 largest equal groups is the tell that you want the GCF.

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

Common mistakes

Practice

Multiple Choice Questions (MCQ)

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

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions 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.

Go deeper (optional)

You can skip this and keep going. Read it if you want to know more.

Why the GCF takes the lowest power of each shared prime

The lesson shows the cap biting on 1212 and 1818: a common factor may carry one 22, because 1818 has only one to give. This runs the same argument on a fresh pair, then on any two numbers at once.

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

Try it on 40=23×540 = 2^3 \times 5 and 60=22×3×560 = 2^2 \times 3 \times 5. Suppose dd divides both of them, and ask how many 22s dd is allowed. Every 22 inside dd has to sit inside 4040 as well, which caps the count at three. Every one has to sit inside 6060 too, which caps it at two. Two is the lower cap, so dd holds at most two 22s. Asking the same of 55 gives one from each side, and asking it of 33 gives none, since 4040 has no 33 to offer. Taking every cap at once builds 22×5=202^2 \times 5 = 20, which is GCF(40,60)\operatorname{GCF}(40, 60).

Now the general form of that. Suppose a number dd divides both aa and bb. Look at any prime pp in the factorization of dd, and say that dd contains pp exactly kk times. Since dd divides aa, those kk copies must already sit inside aa, so aa holds at least kk of them. The same reasoning gives bb at least kk. So kk is at most the smaller of those two counts.

For every prime, then, a common factor can carry no more copies than the number that has fewer of them. The greatest common factor is the one that carries as many as it possibly can. For each shared prime that is the lower of the two powers. A prime sitting in only one of the numbers drops out entirely, because the other has none of it to offer.

Multiply the lowest power of each prime together. The result divides both aa and bb, because it never asks for more copies than either number has. It is also as large as any common factor can be, since it takes the most copies allowed. That is the GCF.

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

The lesson shows the demand landing on 1212 and 1818: a common multiple has to hold two 22s, because every multiple of 1212 carries them along. This runs the same argument on a fresh pair, then on any two numbers at once.

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

Take the same 40=23×540 = 2^3 \times 5 and 60=22×3×560 = 2^2 \times 3 \times 5, and let mm be a multiple of both. Because 4040 divides mm, that mm carries at least three 22s. Because 6060 divides mm, it carries at least two, a demand the three has already met. So three is what the pair asks for, the larger of the two counts. One 33 is demanded by 6060 and one 55 by either number, so the smallest mm meeting every demand is 23×3×5=1202^3 \times 3 \times 5 = 120, which is LCM(40,60)\operatorname{LCM}(40, 60).

Now the general form. Suppose a number mm is a multiple of both aa and bb, so both of them divide mm. Look at any prime pp. Because aa divides mm, that mm holds at least as many copies of pp as aa does. Because bb divides mm, it holds at least as many as bb does. To meet both demands at once, mm needs at least the larger of the two counts.

For every prime, then, a common multiple must carry no fewer copies than the number that has more of them. The least common multiple carries exactly that many and not one extra, which for each prime is the higher of the two powers. A prime sitting in only one number still appears, at the full power it has there, because that number alone demands it.

Multiply the highest power of each prime together. The result is a number that both aa and bb divide, because each prime is present in enough quantity for either one. It is also as small as any common multiple can be, because no prime is taken to more than the largest power required. That is the LCM.

Why the counts always add up, for any two positive numbers

The lesson shows the product rule working on 1212 and 1818, and says why. At each prime the GCF takes the smaller count and the LCM takes the larger, so together they take both. This does that count for every prime at once.

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

Take 40=23×540 = 2^3 \times 5 and 60=22×3×560 = 2^2 \times 3 \times 5 first. Their GCF is 22×52^2 \times 5 and their LCM is 23×3×52^3 \times 3 \times 5. Count the 22s. The GCF took two and the LCM took three, so five between them, and 40×6040 \times 60 holds five as well. The 33s give 0+10 + 1 against 0+10 + 1, and the 55s give 1+11 + 1 against 1+11 + 1. Every prime matches, and 20×120=2400=40×6020 \times 120 = 2400 = 40 \times 60.

Now with letters. If either number is 11 there is nothing to prove: the GCF is 11, the LCM is the other number, and both sides read the same. So take aa and bb above 11.

Multiplying two numbers stands their prime lists side by side, and a number has only one prime list, so that combined list is the product’s. Counting a prime inside a product means adding the two counts.

Fix a prime pp. Let xx be how many copies of it sit in aa, and yy how many sit in bb. Either count may be 00. The two rules already proved say the GCF takes the lower of xx and yy, and the LCM takes the higher. So GCF(a,b)×LCM(a,b)\operatorname{GCF}(a, b) \times \operatorname{LCM}(a, b) holds

(lower of x and y)+(higher of x and y)(\text{lower of } x \text{ and } y) + (\text{higher of } x \text{ and } y)

copies of pp. Here is the whole rule in one step. Take the smaller of xx and yy as the “lower” value, and either one if they are equal. Then “lower” and “higher” are xx and yy again, just named in size order. Sorting two numbers does not change their total, so

(lower of x and y)+(higher of x and y)=x+y,(\text{lower of } x \text{ and } y) + (\text{higher of } x \text{ and } y) = x + y,

and x+yx + y is how many copies of pp sit inside a×ba \times b.

So at every prime the two sides hold the same number of copies. A number has only one prime list, so two numbers built from identical lists cannot be different. Therefore

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

Notice the step that needed a pair. Two counts are a smaller one and a larger one, and the two answers take one each. Three counts have a middle one that neither answer takes, which is why this rule is about two numbers only.

A bit of history (Optional)

You found the GCF by breaking both numbers into primes. That works while the numbers stay small. Hand someone two numbers of forty digits and the method stalls, because nobody can factor those quickly.

An older way never factors anything. A Greek writer named Euclid set it down around 300 BCE, in the geometry book called the Elements, and the recipe carries his name today. Take the two numbers and subtract the smaller from the larger, over and over, until the two are equal. That final value is the GCF.

Run it on 4848 and 6060. Subtracting drives the pair down to 1212 and 1212, so the GCF is 1212. One line explains why. A number that divides both of them also divides their difference. So the difference is safe to use, and it is smaller.

Subtracting one at a time is slow on huge numbers. Modern versions divide instead, replacing the larger number by the remainder, which lands in one step where subtracting took thousands. That change, plus never factoring at all, keeps it quick on numbers hundreds of digits long. It guards internet traffic today. Two thousand years on, it still returns the 1212 your prime powers did.