Mathematics · Book 1 · Grades 1–9

Primary & Middle School Mathematics

Primary & Middle School Mathematics · Grades 1–9

64Arithmetic: Divisors and Prime Numbers

Arithmetic studies whole numbers and how they divide one another. Its central characters are the prime numbers, the building blocks from which every integer is assembled by multiplication. The chapter ends with the greatest common divisor, the right tool for simplifying fractions once and for all. This story continues, much further, in the High School volume and beyond.

64.1 Divisors and multiples

Definition 64.1 (Divisor, multiple)

Let aa and bb be positive integers. We say that bb divides aa (or that bb is a divisor of aa, or that aa is a multiple of bb) when a=b×ka = b \times k for some integer kk — that is, when the division of aa by bb leaves remainder 00.

Example 64.2

The divisors of 2424 are 1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24 — they come in pairs whose product is 2424: (1,24)(1,24), (2,12)(2,12), (3,8)(3,8), (4,6)(4,6). The multiples of 77 are 7,14,21,28,7, 14, 21, 28, \dots

Proposition 64.3 (Divisibility rules)

An integer is divisible:

  • by 22 when its last digit is even (0,2,4,6,80, 2, 4, 6, 8);
  • by 55 when its last digit is 00 or 55;
  • by 1010 when its last digit is 00;
  • by 33 (resp. 99) when the sum of its digits is divisible by 33 (resp. 99);
  • by 44 when its last two digits form a number divisible by 44.

Proof. Admitted at this level.

Example 64.4

72157\,215 ends in 55: divisible by 55. Its digit sum is 7+2+1+5=157 + 2 + 1 + 5 = 15, divisible by 33 but not 99: so 72157\,215 is divisible by 33, not by 99. Indeed 7215=3×5×4817\,215 = 3 \times 5 \times 481.

64.2 Prime numbers

Definition 64.5 (Prime number)

A prime number is an integer 2\geq 2 whose only divisors are 11 and itself. The primes below 3030 are

2, 3, 5, 7, 11, 13, 17, 19, 23, 29.2,\ 3,\ 5,\ 7,\ 11,\ 13,\ 17,\ 19,\ 23,\ 29 .

The number 11 is not prime (by convention), and an integer 2\geq 2 that is not prime is called composite.

Theorem 64.6 (Prime factorization)

Every integer 2\geq 2 is a product of prime numbers, and this factorization is unique up to the order of the factors.

Proof. Admitted at this level.

Method 64.7 (Factoring an integer)

Divide by the smallest possible prime, repeatedly, until reaching 11:

  1. try 22 as long as the number is even;
  2. then try 33, then 55, then 77, … (only primes);
  3. stop when the quotient is 11; collect the factors with exponents.

It suffices to try primes pp with p2p^2 not exceeding the current number: if none divides it, the number itself is prime.

Example 64.8

Factor 360360, one division at a time:

360=2×180,180=2×90,90=2×45,45=3×15,15=3×5,360 = 2 \times 180, \quad 180 = 2 \times 90, \quad 90 = 2 \times 45, \quad 45 = 3 \times 15, \quad 15 = 3 \times 5,

so

360=2×2×2×3×3×5=23×32×5.360 = 2 \times 2 \times 2 \times 3 \times 3 \times 5 = 2^3 \times 3^2 \times 5 .
The factor tree of 360: each step splits off the smallest prime factor (in red). Reading the red leaves and the final 5: 360 = 23 × 32 × 5.
The factor tree of 360360: each step splits off the smallest prime factor (in red). Reading the red leaves and the final 55: 360=23×32×5360 = 2^3 \times 3^2 \times 5.

Theorem 64.9 (Euclid)

There are infinitely many prime numbers.

Proof. Suppose there were only finitely many, say p1,p2,,pkp_1, p_2, \dots, p_k, and consider

N=p1×p2××pk+1.N = p_1 \times p_2 \times \dots \times p_k + 1 .

Dividing NN by any pip_i leaves remainder 11, so no pip_i divides NN. But N2N \geq 2 has at least one prime divisor (Theorem 64.6) — a prime that is not in our list. Contradiction: no finite list can contain all the primes.

64.3 The greatest common divisor

Definition 64.10 (GCD)

The greatest common divisor of two positive integers aa and bb, written gcd(a,b)\gcd(a, b), is the largest integer dividing both. When gcd(a,b)=1\gcd(a, b) = 1, the integers are called coprime: they share no divisor except 11.

Example 64.11

Divisors of 1818: 1,2,3,6,9,181, 2, 3, 6, 9, 18. Divisors of 2424: 1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24. Common divisors: 1,2,3,61, 2, 3, 6; so gcd(18,24)=6\gcd(18, 24) = 6. The integers 1515 and 2828 are coprime.

Proposition 64.12 (GCD from factorizations)

The GCD of two integers is the product of the primes appearing in both factorizations, each taken with the smaller of its two exponents.

Proof. Admitted at this level.

Example 64.13

360=23×32×5360 = 2^3 \times 3^2 \times 5 and 84=22×3×784 = 2^2 \times 3 \times 7. Common primes: 22 (exponents 33 and 22: keep 22) and 33 (exponents 22 and 11: keep 11). So

gcd(360,84)=22×3=12.\gcd(360, 84) = 2^2 \times 3 = 12 .

Theorem 64.14 (Euclidean algorithm)

If a=bq+ra = bq + r is the division of aa by bb with remainder rr, then

gcd(a,b)=gcd(b,r).\gcd(a, b) = \gcd(b, r).

Repeating divisions until the remainder is 00, the GCD of aa and bb is the last nonzero remainder.

Proof. From a=bq+ra = bq + r: any integer dividing bb and rr divides bq+r=abq + r = a; and from r=abqr = a - bq: any integer dividing aa and bb divides rr. So the pairs (a,b)(a, b) and (b,r)(b, r) have exactly the same common divisors — in particular the same greatest one. Since remainders strictly decrease, the algorithm terminates, and gcd(x,0)=x\gcd(x, 0) = x gives the last nonzero remainder.

Example 64.15

Compute gcd(1071,462)\gcd(1071, 462):

1071=462×2+147,462=147×3+21,147=21×7+0.\begin{align*} 1071 &= 462 \times 2 + 147, \\ 462 &= 147 \times 3 + 21, \\ 147 &= 21 \times 7 + 0 . \end{align*}

The last nonzero remainder is 2121: gcd(1071,462)=21\gcd(1071, 462) = 21.

Method 64.16 (Simplifying a fraction completely)

To write ab\dfrac ab in lowest terms:

  1. compute d=gcd(a,b)d = \gcd(a, b), e.g. by the Euclidean algorithm;
  2. divide numerator and denominator by dd: ab=a÷db÷d\dfrac ab = \dfrac{a \div d}{b \div d};
  3. the resulting fraction is irreducible: its numerator and denominator are coprime.

Example 64.17

4621071=462÷211071÷21=2251\dfrac{462}{1071} = \dfrac{462 \div 21}{1071 \div 21} = \dfrac{22}{51}, and gcd(22,51)=1\gcd(22, 51) = 1: irreducible.

64.4 Exercises

Exercise 64.1

List all the divisors of 3636, of 4545, and of 1717.

Solution

Solution of Exercise 64.1.

Divisors of 3636: 1,2,3,4,6,9,12,18,361, 2, 3, 4, 6, 9, 12, 18, 36. Divisors of 4545: 1,3,5,9,15,451, 3, 5, 9, 15, 45. Divisors of 1717: 11 and 1717 only (1717 is prime).

Exercise 64.2

Using the divisibility rules, determine whether 23462\,346 is divisible by 22, by 33, by 44, by 55, by 99.

Solution

Solution of Exercise 64.2.

23462\,346 ends in 66: divisible by 22, not by 55. Digit sum 2+3+4+6=152 + 3 + 4 + 6 = 15: divisible by 33, not by 99. Last two digits 4646, and 46=4×11+246 = 4 \times 11 + 2 is not divisible by 44: 23462\,346 is not divisible by 44.

Exercise 64.3

Give the prime factorization of 7272, 150150, 210210 and 121121.

Solution

Solution of Exercise 64.3.

72=23×3272 = 2^3 \times 3^2; 150=2×3×52150 = 2 \times 3 \times 5^2; 210=2×3×5×7210 = 2 \times 3 \times 5 \times 7; 121=112121 = 11^2.

Exercise 64.4

Is 101101 prime? Is 9191? Is 143143? Justify using the stopping rule of Method 64.7.

Solution

Solution of Exercise 64.4.

101101: test the primes pp with p2101p^2 \leq 101, i.e. 2,3,5,72, 3, 5, 7. None divides 101101 (odd, digit sum 22, does not end in 0/50/5, 101=7×14+3101 = 7 \times 14 + 3): 101101 is prime.

91=7×1391 = 7 \times 13: not prime.

143=11×13143 = 11 \times 13: not prime.

Exercise 64.5

Compute gcd(48,60)\gcd(48, 60) in two ways: by listing common divisors, and from the prime factorizations.

Solution

Solution of Exercise 64.5.

Common divisors of 4848 and 6060: divisors of 48 are 1,2,3,4,6,8,12,16,24,481, 2, 3, 4, 6, 8, 12, 16, 24, 48; divisors of 6060 are 1,2,3,4,5,6,10,12,15,20,30,601, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60; the common ones are 1,2,3,4,6,121, 2, 3, 4, 6, 12, so gcd(48,60)=12\gcd(48,60) = 12.

By factorization: 48=24×348 = 2^4 \times 3 and 60=22×3×560 = 2^2 \times 3 \times 5; common primes with smaller exponents: 22×3=122^2 \times 3 = 12.

Exercise 64.6 ★★

Use the Euclidean algorithm to compute gcd(255,154)\gcd(255, 154), then gcd(1053,325)\gcd(1053, 325). Write every division line.

Solution

Solution of Exercise 64.6.

gcd(255,154)\gcd(255, 154):

255=154×1+101,154=101×1+53,101=53×1+48,53=48×1+5,48=5×9+3,5=3×1+2,3=2×1+1,2=1×2+0.\begin{align*} 255 &= 154 \times 1 + 101, \\ 154 &= 101 \times 1 + 53, \\ 101 &= 53 \times 1 + 48, \\ 53 &= 48 \times 1 + 5, \\ 48 &= 5 \times 9 + 3, \\ 5 &= 3 \times 1 + 2, \\ 3 &= 2 \times 1 + 1, \\ 2 &= 1 \times 2 + 0 . \end{align*}

Last nonzero remainder: gcd(255,154)=1\gcd(255, 154) = 1 (they are coprime).

gcd(1053,325)\gcd(1053, 325):

1053=325×3+78,325=78×4+13,78=13×6+0.\begin{align*} 1053 &= 325 \times 3 + 78, \\ 325 &= 78 \times 4 + 13, \\ 78 &= 13 \times 6 + 0 . \end{align*}

gcd(1053,325)=13\gcd(1053, 325) = 13.

Exercise 64.7 ★★

Make the fraction 588504\dfrac{588}{504} irreducible. (Compute the GCD by the method of your choice, then divide.)

Solution

Solution of Exercise 64.7.

Euclidean algorithm: 588=504×1+84588 = 504 \times 1 + 84; 504=84×6+0504 = 84 \times 6 + 0: gcd(588,504)=84\gcd(588, 504) = 84. Then

588504=588÷84504÷84=76,\frac{588}{504} = \frac{588 \div 84}{504 \div 84} = \frac{7}{6},

which is irreducible.

Exercise 64.8 ★★

A florist has 8484 roses and 126126 tulips and wants to make identical bouquets, using all the flowers, with as many bouquets as possible. How many bouquets can she make, and what does each contain?

Solution

Solution of Exercise 64.8.

The number of bouquets must divide both 8484 and 126126; the largest possible is gcd(84,126)\gcd(84, 126). Factorizations: 84=22×3×784 = 2^2 \times 3 \times 7, 126=2×32×7126 = 2 \times 3^2 \times 7, so the GCD is 2×3×7=422 \times 3 \times 7 = 42. She can make 4242 bouquets, each containing 8442=2\frac{84}{42} = 2 roses and 12642=3\frac{126}{42} = 3 tulips.

Exercise 64.9 ★★

Two ferries leave the same dock at 8:00. One departs every 2424 minutes, the other every 3636 minutes. At what time do they next leave together? (Look for the smallest common multiple of 2424 and 3636; factorizations help.)

Solution

Solution of Exercise 64.9.

We need the least common multiple. 24=23×324 = 2^3 \times 3 and 36=22×3236 = 2^2 \times 3^2; taking each prime with the larger exponent: lcm=23×32=72\lcm = 2^3 \times 3^2 = 72. The ferries next leave together 7272 minutes after 8:00, at 9:12.

Exercise 64.10 ★★★

Let nn be a positive integer.

  1. Show that gcd(n,n+1)=1\gcd(n, n+1) = 1 (consecutive integers are always coprime).
  2. Deduce that the fraction nn+1\dfrac{n}{n+1} is always irreducible.
Solution

Solution of Exercise 64.10.

1. Any common divisor dd of nn and n+1n+1 also divides their difference (n+1)n=1(n+1) - n = 1, so d=1d = 1: gcd(n,n+1)=1\gcd(n, n+1) = 1.

2. A fraction is irreducible exactly when its numerator and denominator are coprime, which is the case for nn and n+1n + 1 by part 1.

64.5 Problem: Water jugs, cicadas and one hundred lockers

Problem 64.1

Weekend problem — the GCD decides which amounts two jugs can measure; primes protect cicadas; and the lockers that stay open are the perfect squares

Three puzzles that look like riddles and are really arithmetic: measuring water with unmarked jugs (the GCD in disguise), insect life cycles that evolved into prime numbers, and a famous corridor of one hundred lockers whose final state is decided by counting divisors. Everything runs on this chapter’s machinery: divisibility, prime factorization (Theorem 64.6) and Euclid’s algorithm (Theorem 64.14).

Part I — The water jugs. You stand at a fountain with two unmarked jugs, of 55 L and 33 L. Allowed moves: fill a jug to the brim, empty a jug completely, pour one jug into the other until the source is empty or the target is full.

  1. Measure exactly 11 L. (Describe your sequence of moves and the two jugs’ contents after each one.)
  2. Measure exactly 44 L — the puzzle from a famous action film. (It can be done in six moves.)
  3. Which whole numbers of liters from 11 to 88 can you exhibit (in one jug, or split across both)? Complete the list, reusing your sequences.
  4. New jugs: 66 L and 44 L. Try to measure 11 L — then explain why it is hopeless: check that each of the three allowed moves keeps every jug’s content a multiple of 22, so every reachable amount is even.
  5. Question 4’s argument works in general: with jugs of aa and bb liters, every reachable amount is a multiple of gcd(a,b)\gcd(a, b). Compute gcd(6,4)\gcd(6, 4) and gcd(5,3)\gcd(5, 3), and say what the law predicts for each pair of jugs.

Part II — Euclid at the fountain.

  1. Compute with Euclid’s algorithm: gcd(91,65)\gcd(91, 65) and gcd(2026,46)\gcd(2\,026, 46).
  2. Explain, in your own words, why the amounts appearing in the jugs are Euclid’s remainders in disguise: with jugs of 1313 L and 55 L, repeatedly fill the small jug and pour it into the big one (emptying the big jug whenever it fills). Which new amounts appear first — and compare them with the remainders in Euclid’s algorithm for (13,5)(13, 5).
  3. Deduce the champion’s answer: with jugs of 1313 and 55 liters, can you measure exactly 11 L? Justify in one line with question 5 and gcd(13,5)\gcd(13, 5).
  4. A quick coprimality proof in the style of Exercise 64.10: show that gcd(n,2n+1)=1\gcd(n, 2n + 1) = 1 for every positive integer nn. (What does a common divisor of nn and 2n+12n + 1 have to divide?)
  5. Two buses leave the terminus together at 7:00; one departs every 1212 minutes, the other every 1818. List the next departure times of each and find the first moment they leave together again. Verify on this example the beautiful law: (first common multiple) ×\times gcd\gcd == product of the two numbers — and test it again on 55 and 33.

Part III — Cicadas, divisors and lockers.

  1. Certain North American cicadas emerge only every 1717 years; suppose a predator’s population peaks every 44 years. If both happen this year, in how many years will an emergence next coincide with a peak? Same question if the cicadas’ cycle were 1616 years — how often would they then be massacred? Explain in one sentence why evolution pushed the cycle to a prime length.
  2. Using the factorization 360=23×32×5360 = 2^3 \times 3^2 \times 5, count the divisors of 360360 without listing them: a divisor chooses an exponent for 22 (four choices: 0,1,2,30, 1, 2, 3), one for 33, one for 55. How many divisors in all?
  3. Show that in the factorization of a perfect square n=m2n = m^2, every prime carries an even exponent. Deduce, without computing any square root, that 360360 is not a perfect square.
  4. Pair each divisor dd of nn with its partner nd\frac{n}{d} (for n=36n = 36: 1361 \leftrightarrow 36, 2182 \leftrightarrow 18, 3123 \leftrightarrow 12, 494 \leftrightarrow 9, 666 \leftrightarrow 6). When is a divisor its own partner? Deduce the criterion: nn has an odd number of divisors exactly when nn is a perfect square. Check it on 3636 and on 360360.
  5. The hundred lockers. Lockers 11 to 100100 start closed. Student 11 toggles every locker; student 22 toggles lockers 2,4,6,2, 4, 6, \dots; student kk toggles the multiples of kk; and so on up to student 100100. Explain which students touch locker nn, how many times it gets toggled, and — using question 14 — exactly which lockers end up open. How many are open?
Solution

Solution of Problem 64.1.

1. Fill the 33 and pour it into the 55 (contents 0/330/3 \to 3 in the big). Fill the 33 again and pour into the 55 until it is full: the big jug takes only 22 more, leaving

32=1 L in the small jug.3 - 2 = 1 \text{ L in the small jug.}

Moves: fill 33; pour 353 \to 5; fill 33; pour 353 \to 5.

2. Fill the 55; pour into the 33 (leaves 22 in the big); empty the 33; pour the 22 into the 33; fill the 55; pour into the 33 until full — it takes 11, leaving 4\mathbf{4} L in the big jug. Six moves.

3. All of them: 11 (question 1), 22 (after two moves of question 2), 33 and 55 (single fillings), 44 (question 2), 6=3+36 = 3 + 3 (a full small jug plus 33 poured into the big), 7=5+27 = 5 + 2, 8=5+38 = 5 + 3 (both full). Every whole amount from 11 to 88 L is measurable with the 55 and the 33.

4. Start: both jugs hold 00, a multiple of 22. Filling sets a content to 66 or 44: even. Emptying sets it to 00: even. Pouring moves some water between jugs whose contents were even, and the poured quantity is a difference of even numbers (space left, or amount available): all contents stay even forever. An odd target like 11 L is unreachable.

5. gcd(6,4)=2\gcd(6, 4) = 2: only even amounts — confirmed by question 4. gcd(5,3)=1\gcd(5, 3) = 1: every whole amount is allowed by the law, and question 3 realized them all. The GCD is exactly the jugs’ unit of measurement.

6. 91=1×65+2691 = 1 \times 65 + 26; 65=2×26+1365 = 2 \times 26 + 13; 26=2×13+026 = 2 \times 13 + 0: gcd(91,65)=13\gcd(91, 65) = 13. And 2026=44×46+22\,026 = 44 \times 46 + 2; 46=23×2+046 = 23 \times 2 + 0: gcd(2026,46)=2\gcd(2\,026, 46) = 2.

7. Pouring 55 into the 1313-jug repeatedly: after two fillings the big jug holds 1010; the third filling fits only 33, leaving 53=25 - 3 = 2 in the small jug — the remainder of 1313 by 55 was 33, and the amounts 33 (space) and 22 (leftover) are exactly Euclid’s numbers (13=2×5+313 = 2 \times 5 + 3, 5=1×3+25 = 1 \times 3 + 2). Continuing, 32=13 - 2 = 1 appears: the algorithm’s next remainder. The fountain performs Euclid’s divisions with water.

8. gcd(13,5)=1\gcd(13, 5) = 1, so the law of question 5 allows every whole amount — and question 7’s cascade actually produced 11 L. Yes.

9. A common divisor of nn and 2n+12n + 1 divides 2n+12×n=12n + 1 - 2 \times n = 1: it must be 11. Hence gcd(n,2n+1)=1\gcd(n, 2n+1) = 1 always.

10. Bus A: 7:12, 7:24, 7:36, 7:48, 8:00 …; bus B: 7:18, 7:36, 7:54 … First common departure: 7:36, after 3636 minutes — the first common multiple of 1212 and 1818. Law: 36×gcd(12,18)=36×6=216=12×1836 \times \gcd(12, 18) = 36 \times 6 = 216 = 12 \times 18. For 55 and 33: first common multiple 1515, and 15×gcd(5,3)=15×1=15=5×315 \times \gcd(5,3) = 15 \times 1 = 15 = 5 \times 3.

11. With a 1717-year cycle: the next coincidence is the first common multiple of 1717 and 44; since gcd(17,4)=1\gcd(17, 4) = 1, that is 17×4=6817 \times 4 = 68 years — the cicadas meet the peak once in four emergences. With a 1616-year cycle: 1616 is a multiple of 44, so every emergence hits a peak. A prime cycle length shares no factor with any shorter predator cycle, pushing coincidences as far apart as possible: arithmetic as camouflage.

12. Four choices of exponent for 22, three for 33, two for 55: 4×3×2=244 \times 3 \times 2 = 24 divisors.

13. If m=2a×3b×m = 2^{a} \times 3^{b} \times \cdots, then m2=22a×32b×m^2 = 2^{2a} \times 3^{2b} \times \cdots: every exponent is doubled, hence even. In 360=23×32×5360 = 2^3 \times 3^2 \times 5, the exponents of 22 and of 55 are odd: 360360 is not a perfect square.

14. A divisor is its own partner exactly when d=ndd = \frac nd, i.e. n=d2n = d^2: only squares have such a middle divisor. For all other nn the divisors split into pairs, an even count. So: odd number of divisors \Leftrightarrow perfect square. Check: 3636 has divisors 1,2,3,4,6,9,12,18,361, 2, 3, 4, 6, 9, 12, 18, 36 — nine of them, odd, and 36=6236 = 6^2; while 360360 has 2424 (question 12), even, and is no square (question 13).

15. Locker nn is toggled once by each student kk whose number divides nn: in all, as many times as nn has divisors. A locker ends open when it is toggled an odd number of times — by question 14, exactly when nn is a perfect square. Open lockers: 1,4,9,16,25,36,49,64,81,1001, 4, 9, 16, 25, 36, 49, 64, 81, 100 — ten of them.