Math Atlas

최대공약수와 최소공배수Greatest Common Factor & Least Common Multiple

기초 산술Foundations · 2. 약수와 배수2. Factors & Multiples

연습Practice108
학습 목표
  • 공약수·최대공약수와 공배수·최소공배수의 뜻을 알고, 나열과 소인수분해 두 방법으로 구할 수 있다.
  • 소인수분해에서 최대공약수는 공통 소인수의 작은 지수를, 최소공배수는 모든 소인수의 큰 지수를 택하는 이유를 설명할 수 있다.
  • 두 수의 곱이 최대공약수와 최소공배수의 곱과 같음을 증명할 수 있다.
  • 두 수의 차로 최대공약수를 구하는 유클리드의 방법을 쓰고, 문장제에서 최대공약수와 최소공배수 중 어느 쪽이 필요한지 판단할 수 있다.

공약수와 최대공약수

2424의 약수는 1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24이고 3636의 약수는 1,2,3,4,6,9,12,18,361, 2, 3, 4, 6, 9, 12, 18, 36이다. 두 목록에 모두 있는 1,2,3,4,6,121, 2, 3, 4, 6, 12가 두 수의 공약수이고, 그중 가장 큰 1212최대공약수다. 눈에 띄는 사실 하나: 공약수 1,2,3,4,6,121, 2, 3, 4, 6, 12는 정확히 최대공약수 1212의 약수들이다. 우연이 아니라는 것을 소인수분해가 보여 준다.

24=2×2×2×324 = 2 \times 2 \times 2 \times 3이고 36=2×2×3×336 = 2 \times 2 \times 3 \times 3이다. 두 수의 소인수를 두 원에 나누어 담되, 공통인 것은 겹치는 부분에 넣자.

24와 36의 소인수. 겹치는 부분의 2, 2, 3을 곱하면 최대공약수 12, 두 원의 소인수를 전부 곱하면 최소공배수 72. 24 36 2 2 2 3 3 2 × 2 × 3 = 12 2 × (2 × 2 × 3) × 3 = 72
24와 36의 소인수. 겹치는 부분의 2, 2, 3을 곱하면 최대공약수 12, 두 원의 소인수를 전부 곱하면 최소공배수 72.

24243636의 공약수는 두 수 모두를 나누어야 하므로, 그 소인수는 2424에도 3636에도 들어 있어야 한다. 즉 공약수의 소인수는 겹치는 부분에서만 나올 수 있다. 겹치는 부분 전체를 곱한 2×2×3=122 \times 2 \times 3 = 12가 가장 큰 공약수이고, 다른 공약수들은 겹치는 부분에서 일부만 고른 것이니 1212의 약수다.

정의소인수분해로 구하는 최대공약수

두 수를 소인수분해한 뒤, 공통 소인수마다 작은 쪽 지수를 택해 곱한다. 24=23×324 = 2^3 \times 3, 36=22×3236 = 2^2 \times 3^2이면 22는 지수 332222, 33은 지수 112211을 택해 22×3=122^2 \times 3 = 12.

작은 쪽 지수를 택하는 이유: 공약수 안의 22의 개수는 242422 개수(33)와 363622 개수(22)를 둘 다 넘을 수 없으니 최대 22개다. 소인수마다 같은 논리다.

공배수와 최소공배수

1212의 배수 12,24,36,48,60,72,12, 24, 36, 48, 60, 72, \ldots1818의 배수 18,36,54,72,18, 36, 54, 72, \ldots에 공통으로 나오는 36,72,108,36, 72, 108, \ldots이 두 수의 공배수, 그중 가장 작은 3636최소공배수다.

위 줄은 12의 배수, 아래 줄은 18의 배수. 36과 72에서 처음 두 번 만난다. 0 6 12 18 24 30 36 42 48 54 60 66 72 0 6 12 18 24 30 36 42 48 54 60 66 72
위 줄은 12의 배수, 아래 줄은 18의 배수. 36과 72에서 처음 두 번 만난다.

공배수 36,72,108,36, 72, 108, \ldots은 모두 최소공배수 3636의 배수다. 두 수의 배수가 만나는 간격이 늘 같기 때문이다. 이것도 소인수분해로 설명된다. 24243636으로 돌아가면, 두 수의 공배수는 두 수 모두의 배수여야 하므로, 22를 적어도 2424만큼(33개) 가지고 33을 적어도 3636만큼(22개) 가져야 한다. 그렇게 꼭 필요한 만큼만 가진 23×32=722^3 \times 3^2 = 72가 최소공배수이고, 벤 다이어그램에서는 두 원의 소인수를 전부 곱한 것이다.

정의소인수분해로 구하는 최소공배수

두 수를 소인수분해한 뒤, 나오는 소인수마다 큰 쪽 지수를 택해 곱한다. 24=23×324 = 2^3 \times 3, 36=22×3236 = 2^2 \times 3^2이면 23×32=722^3 \times 3^2 = 72.

예제 1 · 소인수분해로 두 개 한 번에

1081088484의 최대공약수와 최소공배수를 구하여라.

풀이. 108=22×33108 = 2^2 \times 3^3, 84=22×3×784 = 2^2 \times 3 \times 7.

최대공약수: 공통 소인수 22(지수 2,22, 222)와 33(지수 3,13, 111): 22×3=122^2 \times 3 = 12.

최소공배수: 22(큰 지수 22), 33(큰 지수 33), 77(지수 11): 22×33×7=4×27×7=7562^2 \times 3^3 \times 7 = 4 \times 27 \times 7 = 756.

검산: 108÷12=9108 \div 12 = 9, 84÷12=784 \div 12 = 7이고 9977은 공약수가 11뿐 ✓(더 큰 공약수가 있다면 9977에 남아 있어야 한다). 756÷108=7756 \div 108 = 7, 756÷84=9756 \div 84 = 9 ✓.

곱은 최대공약수 곱하기 최소공배수

벤 다이어그램에서 24×3624 \times 36은 왼쪽 원의 소인수 전부와 오른쪽 원의 소인수 전부를 곱한 것이다. 이때 겹치는 부분(2,2,32, 2, 3)은 두 번 곱해진다. 한편 최대공약수 ×\times 최소공배수는 (겹치는 부분) ×\times (두 원 전부)이고, 두 원 전부에는 겹치는 부분이 한 번 들어 있으니 겹치는 부분이 역시 두 번 곱해진다. 곱해지는 소인수가 완전히 같으므로

24×36=12×72=864.24 \times 36 = 12 \times 72 = 864.

정의곱과 최대공약수·최소공배수

어떤 두 자연수 a,ba, b에 대해서도

a×b=(최대공약수)×(최소공배수).a \times b = (\text{최대공약수}) \times (\text{최소공배수}).

소인수마다 aa의 지수와 bb의 지수 중 작은 것과 큰 것을 더하면 두 지수의 합과 같기 때문이다.

이 식은 둘 중 하나를 알면 나머지를 준다. 최대공약수를 소인수분해 없이 구했다면 최소공배수는 a×b÷(최대공약수)a \times b \div (\text{최대공약수})로 바로 나온다. 특히 최대공약수가 11인 두 수, 즉 공통 소인수가 없는 두 수를 서로소라 하는데, 서로소인 두 수의 최소공배수는 그냥 곱이다. 배수 판정법에서 2233을 겹쳐 66을 판정할 수 있었던 근거가 이것이다.

빼서 구하기: 유클리드의 방법

84846060처럼 소인수분해가 귀찮은 수의 최대공약수는 빼기로 구할 수 있다. 핵심은 약수와 배수 차시의 한 줄이다. dd84846060을 둘 다 나누면, 배수의 차인 8460=2484 - 60 = 24도 나눈다. 거꾸로 dd60602424를 나누면 60+24=8460 + 24 = 84도 나눈다. 그러니 "84846060의 공약수"와 "60602424의 공약수"는 같은 목록이고, 최대공약수도 같다.

(84,60)(60,24)(24,12)(12,12).(84, 60) \to (60, 24) \to (24, 12) \to (12, 12).

6060에서 2424를 두 번 빼서 1212로 갔다. 한 걸음에 여러 번 빼도 된다. 두 수가 같아지면 그 수가 최대공약수다. 1212.

예제 2 · 큰 수를 빼서 줄이기

252252105105의 최대공약수를 빼기로 구하여라.

풀이. 252105105=42252 - 105 - 105 = 42이므로 (252,105)(105,42)(252, 105) \to (105, 42). 1054242=21105 - 42 - 42 = 21이므로 (105,42)(42,21)(105, 42) \to (42, 21). 42=21×242 = 21 \times 2이므로 21214242를 나눈다. 최대공약수는 2121.

검산: 252=21×12252 = 21 \times 12, 105=21×5105 = 21 \times 5, 그리고 121255는 서로소 ✓. 소인수분해로도 252=22×32×7252 = 2^2 \times 3^2 \times 7, 105=3×5×7105 = 3 \times 5 \times 7에서 3×7=213 \times 7 = 21 ✓.

어느 것을 쓸 것인가

문장제에서 최대공약수와 최소공배수를 고르는 기준은 이렇다. 무언가를 똑같이 나누어 가장 크게 만들려면 최대공약수, 무언가가 다시 만나는 가장 이른 때를 찾으려면 최소공배수다.

예제 3 · 가장 큰 정사각형 타일

가로 108cm108\,\text{cm}, 세로 84cm84\,\text{cm}인 바닥을 같은 크기의 정사각형 타일로 빈틈없이 덮으려 한다. 타일을 자르지 않고 가장 큰 타일을 쓰면 한 변은 몇 cm이고, 타일은 몇 장 필요한가?

풀이. 타일의 한 변은 1081088484 둘 다를 나누어야 하므로 공약수이고, 가장 큰 것은 최대공약수 12cm12\,\text{cm}(예제 1). 가로에 108÷12=9108 \div 12 = 9장, 세로에 84÷12=784 \div 12 = 7장이므로 9×7=639 \times 7 = 63장.

검산: 12×9=10812 \times 9 = 108, 12×7=8412 \times 7 = 84 ✓. 넓이로도 108×84=9,072108 \times 84 = 9{,}072, 12×12×63=144×63=9,07212 \times 12 \times 63 = 144 \times 63 = 9{,}072 ✓.

예제 4 · 다시 만나는 때

어느 정류장에서 1212분마다 출발하는 버스와 1818분마다 출발하는 버스가 오전 99시에 동시에 출발했다. 다음에 동시에 출발하는 시각은?

풀이. 두 버스가 다시 만나는 시각은 1212의 배수이면서 1818의 배수인 분 뒤, 즉 공배수 뒤이고 가장 이른 것은 최소공배수 3636분 뒤다. 오전 993636분.

검산: 3636분 동안 첫 버스는 33번, 둘째 버스는 22번 출발 간격을 채운다 ✓. 그림의 수직선에서 두 줄이 처음 만나는 눈금이 3636이다 ✓.

Goals
  • Know what common factors, the greatest common factor, common multiples, and the least common multiple are, and find them by listing and by prime factorization.
  • Explain why the GCF takes the smaller exponent of each shared prime, and the LCM the larger exponent of every prime.
  • Prove that the product of two numbers equals their GCF times their LCM.
  • Use Euclid's subtraction method to find a GCF, and decide in a word problem whether the GCF or the LCM is needed.

Common factors and the greatest common factor

The factors of 2424 are 1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24; the factors of 3636 are 1,2,3,4,6,9,12,18,361, 2, 3, 4, 6, 9, 12, 18, 36. The numbers on both lists, 1,2,3,4,6,121, 2, 3, 4, 6, 12, are the common factors of the two numbers, and the largest, 1212, is their greatest common factor (GCF). Notice something: the common factors 1,2,3,4,6,121, 2, 3, 4, 6, 12 are exactly the factors of the GCF 1212. Prime factorization shows this is no accident.

24=2×2×2×324 = 2 \times 2 \times 2 \times 3 and 36=2×2×3×336 = 2 \times 2 \times 3 \times 3. Put the prime factors of each number in a circle, with the shared ones in the overlap.

The prime factors of 24 and 36. Multiplying the overlap, 2, 2, 3, gives the GCF 12; multiplying everything in both circles gives the LCM 72. 24 36 2 2 2 3 3 2 × 2 × 3 = 12 2 × (2 × 2 × 3) × 3 = 72
The prime factors of 24 and 36. Multiplying the overlap, 2, 2, 3, gives the GCF 12; multiplying everything in both circles gives the LCM 72.

A common factor of 2424 and 3636 divides both, so each of its prime factors must be present in 2424 and in 3636. That is, the primes of a common factor can only come from the overlap. Multiplying the entire overlap, 2×2×3=122 \times 2 \times 3 = 12, gives the largest common factor, and every other common factor uses only part of the overlap, so it is a factor of 1212.

DefinitionGCF from prime factorizations

Factor both numbers into primes, then for each shared prime take the smaller exponent and multiply. For 24=23×324 = 2^3 \times 3 and 36=22×3236 = 2^2 \times 3^2: for 22 take the smaller of 33 and 22, for 33 the smaller of 11 and 22, giving 22×3=122^2 \times 3 = 12.

Why the smaller exponent: the number of 22s in a common factor cannot exceed the 22s in 2424 (three) nor the 22s in 3636 (two), so at most two. The same goes for every prime.

Common multiples and the least common multiple

The multiples of 1212 are 12,24,36,48,60,72,12, 24, 36, 48, 60, 72, \ldots and the multiples of 1818 are 18,36,54,72,18, 36, 54, 72, \ldots. The numbers on both lists, 36,72,108,36, 72, 108, \ldots, are the common multiples, and the smallest, 3636, is the least common multiple (LCM).

The top line marks the multiples of 12, the bottom line the multiples of 18. They first meet at 36 and again at 72. 0 6 12 18 24 30 36 42 48 54 60 66 72 0 6 12 18 24 30 36 42 48 54 60 66 72
The top line marks the multiples of 12, the bottom line the multiples of 18. They first meet at 36 and again at 72.

The common multiples 36,72,108,36, 72, 108, \ldots are all multiples of the LCM 3636, because the two sequences of multiples meet at regular intervals. Prime factorization explains this too. Back with 2424 and 3636: a common multiple of the two must be a multiple of each, so it needs at least as many 22s as 2424 has (three) and at least as many 33s as 3636 has (two). The number with exactly that much and nothing more, 23×32=722^3 \times 3^2 = 72, is the LCM; in the Venn diagram it is the product of everything in both circles.

DefinitionLCM from prime factorizations

Factor both numbers into primes, then for each prime that appears take the larger exponent and multiply. For 24=23×324 = 2^3 \times 3 and 36=22×3236 = 2^2 \times 3^2: 23×32=722^3 \times 3^2 = 72.

Example 1 · Both at once from the factorizations

Find the GCF and LCM of 108108 and 8484.

Solution. 108=22×33108 = 2^2 \times 3^3 and 84=22×3×784 = 2^2 \times 3 \times 7.

GCF: shared primes 22 (exponents 2,22, 2, take 22) and 33 (exponents 3,13, 1, take 11): 22×3=122^2 \times 3 = 12.

LCM: 22 (larger exponent 22), 33 (larger exponent 33), 77 (exponent 11): 22×33×7=4×27×7=7562^2 \times 3^3 \times 7 = 4 \times 27 \times 7 = 756.

Check: 108÷12=9108 \div 12 = 9 and 84÷12=784 \div 12 = 7, and 99 and 77 share no factor but 11 ✓ (a larger common factor would still show up in 99 and 77). Also 756÷108=7756 \div 108 = 7 and 756÷84=9756 \div 84 = 9 ✓.

The product is GCF times LCM

In the Venn diagram, 24×3624 \times 36 multiplies every prime in the left circle and every prime in the right circle, so the overlap (2,2,32, 2, 3) is multiplied twice. Meanwhile GCF ×\times LCM is (the overlap) ×\times (everything in both circles), and "everything in both circles" already contains the overlap once, so again the overlap is multiplied twice. The primes being multiplied are identical, hence

24×36=12×72=864.24 \times 36 = 12 \times 72 = 864.

DefinitionProduct, GCF, and LCM

For any two whole numbers aa and bb,

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

For each prime, the smaller of the two exponents plus the larger of the two equals the sum of the two exponents.

This gives either one from the other. If the GCF was found without factoring, the LCM is simply a×b÷(GCF)a \times b \div (\text{GCF}). Two numbers whose GCF is 11, that is, with no prime in common, are called relatively prime (or coprime), and their LCM is just their product. This is the reason the divisibility tests for 22 and 33 could be combined into a test for 66.

Finding a GCF by subtracting: Euclid's method

For numbers like 8484 and 6060, whose factorizations are a nuisance, the GCF can be found by subtracting. The key is one line from the factors-and-multiples lesson: if dd divides both 8484 and 6060, it divides their difference 8460=2484 - 60 = 24 as well. Conversely, if dd divides 6060 and 2424, it divides 60+24=8460 + 24 = 84. So "the common factors of 8484 and 6060" and "the common factors of 6060 and 2424" are the same list, and the GCF is the same.

(84,60)(60,24)(24,12)(12,12).(84, 60) \to (60, 24) \to (24, 12) \to (12, 12).

From 6060 we subtracted 2424 twice to reach 1212; several subtractions in one step are fine. When the two numbers become equal, that number is the GCF: 1212.

Example 2 · Shrinking large numbers by subtraction

Find the GCF of 252252 and 105105 by subtracting.

Solution. 252105105=42252 - 105 - 105 = 42, so (252,105)(105,42)(252, 105) \to (105, 42). Then 1054242=21105 - 42 - 42 = 21, so (105,42)(42,21)(105, 42) \to (42, 21). Since 42=21×242 = 21 \times 2, 2121 divides 4242, and the GCF is 2121.

Check: 252=21×12252 = 21 \times 12 and 105=21×5105 = 21 \times 5, with 1212 and 55 relatively prime ✓. By factoring, 252=22×32×7252 = 2^2 \times 3^2 \times 7 and 105=3×5×7105 = 3 \times 5 \times 7 share 3×7=213 \times 7 = 21 ✓.

Which one to use

In word problems the choice goes like this: to split something equally into the largest possible pieces, use the GCF; to find the earliest moment something happens again together, use the LCM.

Example 3 · The largest square tile

A floor 108cm108\,\text{cm} by 84cm84\,\text{cm} is to be covered completely with identical square tiles, none of them cut. What is the side of the largest tile that works, and how many tiles are needed?

Solution. The tile's side must divide both 108108 and 8484, so it is a common factor, and the largest is the GCF, 12cm12\,\text{cm} (Example 1). That takes 108÷12=9108 \div 12 = 9 tiles across and 84÷12=784 \div 12 = 7 tiles down: 9×7=639 \times 7 = 63 tiles.

Check: 12×9=10812 \times 9 = 108 and 12×7=8412 \times 7 = 84 ✓. By area, 108×84=9,072108 \times 84 = 9{,}072 and 12×12×63=144×63=9,07212 \times 12 \times 63 = 144 \times 63 = 9{,}072 ✓.

Example 4 · Meeting again

At a bus stop, one bus leaves every 1212 minutes and another every 1818 minutes. Both left at 9:00 a.m. When do they next leave together?

Solution. They leave together after a number of minutes that is a multiple of 1212 and of 1818, that is, a common multiple, and the earliest is the LCM, 3636 minutes. So at 9:36 a.m.

Check: in 3636 minutes the first bus completes 33 intervals and the second completes 22 ✓. On the number lines in the figure, the first tick shared by both rows is 3636 ✓.