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 and be positive integers. We say that divides (or that is a divisor of , or that is a multiple of ) when for some integer — that is, when the division of by leaves remainder .
Example 64.2
The divisors of are — they come in pairs whose product is : , , , . The multiples of are
Proposition 64.3 (Divisibility rules)
An integer is divisible:
Proof. Admitted at this level. ∎
Example 64.4
ends in : divisible by . Its digit sum is , divisible by but not : so is divisible by , not by . Indeed .
64.2 Prime numbers
Definition 64.5 (Prime number)
A prime number is an integer whose only divisors are and itself. The primes below are
The number is not prime (by convention), and an integer that is not prime is called composite.
Theorem 64.6 (Prime factorization)
Every integer 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 :
- try as long as the number is even;
- then try , then , then , … (only primes);
- stop when the quotient is ; collect the factors with exponents.
It suffices to try primes with not exceeding the current number: if none divides it, the number itself is prime.
Example 64.8
Factor , one division at a time:
so
Theorem 64.9 (Euclid)
There are infinitely many prime numbers.
Proof. Suppose there were only finitely many, say , and consider
Dividing by any leaves remainder , so no divides . But 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 and , written , is the largest integer dividing both. When , the integers are called coprime: they share no divisor except .
Example 64.11
Divisors of : . Divisors of : . Common divisors: ; so . The integers and 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
and . Common primes: (exponents and : keep ) and (exponents and : keep ). So
Theorem 64.14 (Euclidean algorithm)
If is the division of by with remainder , then
Repeating divisions until the remainder is , the GCD of and is the last nonzero remainder.
Proof. From : any integer dividing and divides ; and from : any integer dividing and divides . So the pairs and have exactly the same common divisors — in particular the same greatest one. Since remainders strictly decrease, the algorithm terminates, and gives the last nonzero remainder. ∎
Example 64.15
Compute :
The last nonzero remainder is : .
Method 64.16 (Simplifying a fraction completely)
To write in lowest terms:
- compute , e.g. by the Euclidean algorithm;
- divide numerator and denominator by : ;
- the resulting fraction is irreducible: its numerator and denominator are coprime.
Example 64.17
, and : irreducible.
64.4 Exercises
Exercise 64.1 ★
List all the divisors of , of , and of .
Exercise 64.2 ★
Using the divisibility rules, determine whether is divisible by , by , by , by , by .
Exercise 64.3 ★
Give the prime factorization of , , and .
Solution
Solution of Exercise 64.3.
; ; ; .
Exercise 64.4 ★
Is prime? Is ? Is ? Justify using the stopping rule of Method 64.7.
Exercise 64.5 ★
Compute in two ways: by listing common divisors, and from the prime factorizations.
Exercise 64.6 ★★
Use the Euclidean algorithm to compute , then . Write every division line.
Exercise 64.7 ★★
Make the fraction irreducible. (Compute the GCD by the method of your choice, then divide.)
Solution
Solution of Exercise 64.7.
Euclidean algorithm: ; : . Then
which is irreducible.
Exercise 64.8 ★★
A florist has roses and 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 and ; the largest possible is . Factorizations: , , so the GCD is . She can make bouquets, each containing roses and tulips.
Exercise 64.9 ★★
Two ferries leave the same dock at 8:00. One departs every minutes, the other every minutes. At what time do they next leave together? (Look for the smallest common multiple of and ; factorizations help.)
Exercise 64.10 ★★★
Let be a positive integer.
- Show that (consecutive integers are always coprime).
- Deduce that the fraction is always irreducible.
Solution
Solution of Exercise 64.10.
1. Any common divisor of and also divides their difference , so : .
2. A fraction is irreducible exactly when its numerator and denominator are coprime, which is the case for and 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 L and 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.
- Measure exactly L. (Describe your sequence of moves and the two jugs’ contents after each one.)
- Measure exactly L — the puzzle from a famous action film. (It can be done in six moves.)
- Which whole numbers of liters from to can you exhibit (in one jug, or split across both)? Complete the list, reusing your sequences.
- New jugs: L and L. Try to measure L — then explain why it is hopeless: check that each of the three allowed moves keeps every jug’s content a multiple of , so every reachable amount is even.
- Question 4’s argument works in general: with jugs of and liters, every reachable amount is a multiple of . Compute and , and say what the law predicts for each pair of jugs.
Part II — Euclid at the fountain.
- Compute with Euclid’s algorithm: and .
- Explain, in your own words, why the amounts appearing in the jugs are Euclid’s remainders in disguise: with jugs of L and 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 .
- Deduce the champion’s answer: with jugs of and liters, can you measure exactly L? Justify in one line with question 5 and .
- A quick coprimality proof in the style of Exercise 64.10: show that for every positive integer . (What does a common divisor of and have to divide?)
- Two buses leave the terminus together at 7:00; one departs every minutes, the other every . 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) product of the two numbers — and test it again on and .
Part III — Cicadas, divisors and lockers.
- Certain North American cicadas emerge only every years; suppose a predator’s population peaks every 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 years — how often would they then be massacred? Explain in one sentence why evolution pushed the cycle to a prime length.
- Using the factorization , count the divisors of without listing them: a divisor chooses an exponent for (four choices: ), one for , one for . How many divisors in all?
- Show that in the factorization of a perfect square , every prime carries an even exponent. Deduce, without computing any square root, that is not a perfect square.
- Pair each divisor of with its partner (for : , , , , ). When is a divisor its own partner? Deduce the criterion: has an odd number of divisors exactly when is a perfect square. Check it on and on .
- The hundred lockers. Lockers to start closed. Student toggles every locker; student toggles lockers ; student toggles the multiples of ; and so on up to student . Explain which students touch locker , 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 and pour it into the (contents in the big). Fill the again and pour into the until it is full: the big jug takes only more, leaving
Moves: fill ; pour ; fill ; pour .
2. Fill the ; pour into the (leaves in the big); empty the ; pour the into the ; fill the ; pour into the until full — it takes , leaving L in the big jug. Six moves.
3. All of them: (question 1), (after two moves of question 2), and (single fillings), (question 2), (a full small jug plus poured into the big), , (both full). Every whole amount from to L is measurable with the and the .
4. Start: both jugs hold , a multiple of . Filling sets a content to or : even. Emptying sets it to : 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 L is unreachable.
5. : only even amounts — confirmed by question 4. : every whole amount is allowed by the law, and question 3 realized them all. The GCD is exactly the jugs’ unit of measurement.
6. ; ; : . And ; : .
7. Pouring into the -jug repeatedly: after two fillings the big jug holds ; the third filling fits only , leaving in the small jug — the remainder of by was , and the amounts (space) and (leftover) are exactly Euclid’s numbers (, ). Continuing, appears: the algorithm’s next remainder. The fountain performs Euclid’s divisions with water.
8. , so the law of question 5 allows every whole amount — and question 7’s cascade actually produced L. Yes.
9. A common divisor of and divides : it must be . Hence 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 minutes — the first common multiple of and . Law: . For and : first common multiple , and .
11. With a -year cycle: the next coincidence is the first common multiple of and ; since , that is years — the cicadas meet the peak once in four emergences. With a -year cycle: is a multiple of , 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 , three for , two for : divisors.
13. If , then : every exponent is doubled, hence even. In , the exponents of and of are odd: is not a perfect square.
14. A divisor is its own partner exactly when , i.e. : only squares have such a middle divisor. For all other the divisors split into pairs, an even count. So: odd number of divisors perfect square. Check: has divisors — nine of them, odd, and ; while has (question 12), even, and is no square (question 13).
15. Locker is toggled once by each student whose number divides : in all, as many times as has divisors. A locker ends open when it is toggled an odd number of times — by question 14, exactly when is a perfect square. Open lockers: — ten of them.