Download 21-110: Problem Solving in Recreational Mathematics

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Addition wikipedia , lookup

Location arithmetic wikipedia , lookup

Elementary mathematics wikipedia , lookup

List of prime numbers wikipedia , lookup

Quadratic reciprocity wikipedia , lookup

Collatz conjecture wikipedia , lookup

Factorization wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
21-110: Problem Solving in Recreational Mathematics
Homework assignment 4 solutions
Problem 1. Recall that n!, read “n factorial,” is the number n × (n − 1) × (n − 2) × · · · × 3 × 2 × 1.
For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. The number 110! ends with a bunch of zeroes. How
many?
Solution. A zero at the end of a number is a consequence of a factor of 10. For example, the
number 70 ends with one zero because it has one factor of 10 (70 = 7 × 10), and the number 12,000
ends with three zeroes because it has three factors of 10 (12,000 = 12 × 10 × 10 × 10). So to count
the number of zeroes at the end of 110! we need to count the number of factors of 10 in 110!.
One factor of 10 is the same as one factor of 2 and one factor of 5, since 2 and 5 are the prime
factors of 10. We can see how many factors of 2 and factors of 5 a number has by looking at the
prime factorization of the number.
Let’s return to the examples above. The prime factorization of 70 is 2 × 5 × 7. The 2 and the 5
combine to make a factor of 10, so we can tell from the prime factorization that 70 has one zero at
the end. Similarly, the prime factorization of 12,000 is 2 × 2 × 2 × 2 × 2 × 3 × 5 × 5 × 5, or 25 × 3 × 53 .
The three factors of 5 combine with three of the five factors of 2 to form three factors of 10 in 12,000,
giving us three zeroes at the end. (The other two factors of 2 are “leftovers,” because there are no
more factors of 5 for them to combine with.)
In a factorial the factors of 2 will always outnumber the factors of 5, since every even number
in the product n × (n − 1) × (n − 2) × · · · × 3 × 2 × 1 will contribute at least one factor of 2, whereas
factors of 5 are contributed only by multiples of 5 (which occur more rarely). This means that we
can count the factors of 10 in a factorial by counting how many factors of 5 it has (because there
will always be enough factors of 2 to combine with them).
In the number 110!, every multiple of 5 from 5 up to 110 contributes one factor of 5. This gives
us 110/5 = 22 factors of 5, which will give us 22 zeroes at the end of 110!.
But there are a few more factors of 5. The number 25 will contribute not one but two factors of 5
to the number 110!, as will all multiples of 25 (50, 75, and 100). So there are four additional factors
of 5, giving us four more zeroes at the end of 110!. (If, instead of 110!, we had been considering
the number 150!, say, we would also need to consider the fact that 53 , or 125, will contribute three
factors of 5, and so on.)
In total, then, the number 110! ends with 26 zeroes.
Problem 2. What is the remainder when 321,110 is divided by 7?
Solution. There are at least three ways to solve this problem. Perhaps the simplest is to start
looking at small powers of 3 and their remainders when divided by 7, in the hopes of finding a
pattern.
n
n
3
rem.
1 2 3
4
5
6
7
8
9
10
11
12
13
...
3 9 27 81 243 729 2,187 6,561 19,683 59,049 177,147 531,441 1,594,323 . . .
3 2 6 4 5
1
3
2
6
4
5
1
3
...
We see that these remainders repeat 3, 2, 6, 4, 5, 1 over and over, in other words, every sixth power
of 3. The greatest multiple of 6 less than 21,110 is 21,108, which is 6 × 3,518. So if we were to
continue this table all the way to 321,110 , we would have 3,518 repetitions of the sequence 3, 2, 6,
4, 5, 1, which would bring us up to 321,108 ; two more powers of 3 would give us 321,110 and would
bring us two numbers into the next repetition of the sequence. The second number of the repeating
sequence is 2, so the remainder when 321,110 is divided by 7 is 2.
The second approach is similar, but uses modular arithmetic to simplify the calculations. Since
we are interested in remainders when numbers are divided by 7, we can do all of our calculations
modulo 7 and work only with remainders rather than having to juggle big numbers like 1,594,323.
Obviously 31 ≡ 3 (mod 7). Next we multiply 31 by 3 and get 3 × 3 = 9, which has a remainder of 2
Page 1
when divided by 7; so 32 ≡ 2 (mod 7). To find 33 , rather than multiplying 9 by 3, we can simply
multiply this remainder 2 by 3 to get 33 = 32 × 3 ≡ 2 × 3 = 6 (mod 7). For 34 , we multiply this
remainder 6 by 3 to get 34 = 33 × 3 ≡ 6 × 3 = 18 ≡ 4 (mod 7). Continuing in this way, we can build
up a table as before, calculating only with remainders:
n
1
2
3
4
5
6
7
...
3 (mod 7)
3
2
6
4
5
1
3
...
n
We don’t have to extend the table as far to see the pattern this time, because we know (from the
way we are calculating these remainders) that the pattern will repeat once we’ve come back to where
we started. For example, to find 38 , we multiply 37 (which is congruent to 3 modulo 7) by 3 to get
38 = 37 × 3 ≡ 3 × 3 = 9 ≡ 2 (mod 7), which is the same as 32 .
Now that we have found the pattern, we can use the same reasoning as we used in the first
approach to see that the pattern of remainders will fully repeat 3,518 times, and go two numbers
further, giving us a remainder of 2 when 321,110 is divided by 7.
The third approach is a further refinement. We begin this time by finding the smallest positive
integer power of 3 that is congruent to 1 modulo 7. So we start with 31 and then find 32 , 33 , and
so on (using modular arithmetic) until we get a remainder of 1. From what we have done before,
we know that 6 is the smallest such power of 3, because 36 ≡ 1 (mod 7). We can use this fact to
compute the remainder when 321,110 is divided by 7 by using modular arithmetic (modulo 7) and
grouping the factors of 3 into clusters of six, each of which is congruent to 1 modulo 7:
321,110 = 3 × 3 × 3 × · · · × 3
{z
}
|
21,110 factors
= (3×3×3×3×3×3) × (3×3×3×3×3×3) × · · · × (3×3×3×3×3×3) × 3 × 3
|
{z
}
| {z }
3,518 of these clusters
≡ 1 × 1 × ··· × 1 × 3 × 3
|
{z
}
leftovers
(mod 7)
3,518 factors
=9
≡ 2 (mod 7).
Any way we do it, we see that 321,110 yields a remainder of 2 when it is divided by 7.
Problem 3. In class we showed that the least common multiple of 10 and 12 is lcm(10, 12) = 60 and
the greatest common divisor of 10 and 12 is gcd(10, 12) = 2. We then observed that 10 × 12 = 120
and 60 × 2 = 120. Does this always happen? In other words, is it true that for every possible pair
of positive integers a and b,
a · b = lcm(a, b) · gcd(a, b)?
If so, explain why. If not, give a counterexample (that is, give two positive integers a and b for which
this statement is false).
Solution. This equality is always true, for every possible pair of positive integers a and b. To see
why this is, we consider the prime factorizations of a and b.
Suppose p is a prime number that is a factor of a or b (or both). Suppose further that a has
exactly m factors of p (that is, pm | a but pm+1 - a) and that b has exactly n factors of p. (It is
possible that one of m or n is zero, if p is not a factor of both a and b.) Then their product ab has
exactly m + n factors of p.
How many factors of p are in lcm(a, b) and gcd(a, b)? To find the greatest common divisor of a
and b, we take as many factors of p as possible without exceeding m or n. In other words, if m < n
then gcd(a, b) has exactly m factors of p, and if m ≥ n then gcd(a, b) has exactly n factors of p.
Page 2
Similarly, to find the least common multiple of a and b, we take the smallest number of factors
of p that is at least as large as both a and b. So if m < n then lcm(a, b) has exactly n factors of p,
and if m ≥ n then lcm(a, b) has exactly m factors of p.
Therefore we have two cases. In the first case m is less than n, so gcd(a, b) has exactly m factors
of p, and lcm(a, b) has exactly n factors of p. Then the product lcm(a, b) · gcd(a, b) has exactly
m + n factors of p. In the second case m is greater than or equal to n, so gcd(a, b) has exactly
n factors of p, and lcm(a, b) has exactly m factors of p, meaning that the product lcm(a, b) · gcd(a, b)
again has exactly m + n factors of p.
Hence, in any case, lcm(a, b) · gcd(a, b) has exactly as many factors of p as ab does. Since p
represents an arbitrary prime factor, this argument must remain true for all the prime factors of
either a or b. Therefore the prime factorization of lcm(a, b) · gcd(a, b) is exactly the same as the
prime factorization of ab, which means that a · b = lcm(a, b) · gcd(a, b).
Problem 4. A long hallway has 100 light bulbs, numbered 1 through 100. Each light bulb has a
pull string; when the string is pulled, the light bulb turns on if it was off, and turns off if it was on.
All of the light bulbs are initially off.
One person walks into the hall, pulls every string, and walks out. Then a second person enters,
pulls the strings of light bulbs 2, 4, 6, 8, and so on, and leaves. Next, a third person comes in, pulls
strings 3, 6, 9, 12, and so on, and exits. This pattern continues until 100 people have walked in,
pulled some of the strings, and walked out. (Note that the 100th person will pull only string 100.)
After all 100 people have done this, which light bulbs are on? More importantly, why?
Solution. The first observation we make is that, at the end, the light bulbs that are on are precisely
those light bulbs whose strings were pulled an odd number of times. This is a useful observation
to make, even though it doesn’t immediately go very far in telling us which of the numbered light
bulbs will be on.
From some experimentation (perhaps considering only the first 25 light bulbs rather than
all 100), we see that the light bulbs that are on at the end are numbers 1, 4, 9, 16, 25, and so
on. This leads us to conjecture that it is the perfect squares that will be on.
Let’s consider a given string (say, the string for light bulb 12). Which people pull this string?
Well, string 12 is pulled by people 1, 2, 3, 4, 6, and 12. Aha! Since each person pulls the strings
that are multiples of his or her number, each string will be pulled once for each of its divisors. Since
12 has six divisors (including 12 itself), the string for light bulb 12 will be pulled six times. Since 6
is an even number, this means that light bulb 12 will be off.
From the observation we made at the start, we see that our conjecture is equivalent to the
following statement:
Every perfect square has an odd number of divisors;
every number that is not a perfect square has an even number of divisors.
If we can establish that this statement is true, we will have an explanation for the claim that the
light bulbs that are on are precisely those whose numbers are perfect squares.
Let’s begin with the claim that every number that is not a perfect square has an even number of
divisors. (Let’s continue using 12 as our example.) There is a trick that is often useful when trying
to show that some collection has an even number of things: Try to find a way to pair them up. Is
there a way that we can pair up the divisors of 12? After some thought, we see that there is indeed
a very natural way to do this. For every divisor n of 12, the number 12/n is also a divisor of 12.
So the divisors 1 and 12 can be paired up, because 1 × 12 = 12; 2 and 6 can be paired up, because
2 × 6 = 12; and 3 and 4 can be paired up, because 3 × 4 = 12. Since we are able to pair up all of
the divisors of 12 with no leftovers, we see that 12 has an even number of divisors. It seems that
this trick will work with the divisors of any positive integer, which would show that every positive
integer has an even number of divisors.
But wait. We are also claiming that every perfect square has an odd number of divisors, so
this pairing-up trick must fail for the divisors of a perfect square. Why? Let’s consider 16 as an
Page 3
example. The divisors of 16 are 1, 2, 4, 8, and 16. If we try to pair them up, we put 1 with 16,
because 1 × 16 = 16; we put 2 with 8, because 2 × 8 = 16; and we put 4 with—oops. We would
like to put 4 with 4 (because 4 × 4 = 16), but then we aren’t pairing it with anything. This is the
reason a perfect square has an odd number of divisors: each of the divisors pairs up with some other
divisor, except the square root. Since we have one divisor left over after this pairing-up, a perfect
square must have an odd number of divisors.
Therefore, our final answer (and justification) goes like this: Every positive integer a that is not
a perfect square has an even number of divisors, because every divisor n of a can be paired with the
divisor a/n, which is an integer (since n | a) and is different from n (since a is not a perfect square).
On the other hand, every perfect square b has an odd number of divisors, because every divisor of
√b
other than the square root can be paired with another divisor of b as above, but the square root b
is left over at the end.
Now, the string for a given light bulb will be pulled once for each of the divisors of the number
on the bulb, and at the end a light bulb will be on if and only if its string was pulled an odd number
of times. Therefore, the light bulbs that are on after all 100 people have gone through the hall are
precisely those bulbs marked with a perfect square.
[See also “Odd Divisors” on page 184 of Thinking Mathematically.]
Problem 5. Consider the polynomial function f (x) = x2 + x + 41. Compute the values f (0), f (1),
f (2), f (3), . . . , f (20). What can you say about the primality of these numbers? (That is, are they
prime numbers or not?) Does this pattern continue forever? Why or why not?
[This interesting property of this polynomial was discovered by the Swiss mathematician Leonhard
Euler (pronounced “Oiler”) in 1772.]
Solution. The values of f (x) for the first 40 nonnegative integer values of x are given below.
f (0) = 41, prime.
f (10) = 151, prime.
f (20) = 461, prime.
f (30) = 971, prime.
f (1) = 43, prime.
f (11) = 173, prime.
f (21) = 503, prime.
f (31) = 1033, prime.
f (2) = 47, prime.
f (12) = 197, prime.
f (22) = 547, prime.
f (32) = 1097, prime.
f (3) = 53, prime.
f (13) = 223, prime.
f (23) = 593, prime.
f (33) = 1163, prime.
f (4) = 61, prime.
f (14) = 251, prime.
f (24) = 641, prime.
f (34) = 1231, prime.
f (5) = 71, prime.
f (15) = 281, prime.
f (25) = 691, prime.
f (35) = 1301, prime.
f (6) = 83, prime.
f (16) = 313, prime.
f (26) = 743, prime.
f (36) = 1373, prime.
f (7) = 97, prime.
f (17) = 347, prime.
f (27) = 797, prime.
f (37) = 1447, prime.
f (8) = 113, prime.
f (18) = 383, prime.
f (28) = 853, prime.
f (38) = 1523, prime.
f (9) = 131, prime.
f (19) = 421, prime.
f (29) = 911, prime.
f (39) = 1601, prime.
Surely, with this much evidence, it seems a safe bet that f (x) is prime for all nonnegative integer
values of x. But this is not the case! Let’s go just two steps further and consider f (41):
f (41) = 412 + 41 + 41 = 41(41 + 1 + 1) = 41 × 43,
so f (41) is composite. Therefore the answer to the question is no; the pattern continues for quite a
while, but not forever. In fact there are infinitely many values of x for which f (x) is composite (any
multiple of 41, for example).
It turns out that f (40) is also composite, although this takes some cleverer algebraic factoring
to see:
f (40) = 402 + 40 + 41 = 402 + 40 + 40 + 1 = 402 + 2(40) + 1 = (40 + 1)2 = 412 = 41 × 41.
[This is a famous example of a false pattern that strongly appears to be true if only the first few
cases are investigated. Examples such as these emphasize the importance of mathematical proof,
rather than simply strong evidence, to establish that conjectures are true.]
Page 4
Problem 6. Use the definition of divisibility to prove the following statement about integers a, b,
c, x, and y, where a 6= 0: If a | b and a | c, then a | (bx + cy).
Solution. Since a | b, there exists an integer d such that b = ad (by the definition of divisibility).
Likewise, since a | c, there exists an integer e (probably different from d) such that c = ae. Therefore,
bx + cy = (ad)x + (ae)y = a(dx) + a(ey) = a(dx + ey).
Since dx + ey is an integer, we see from the definition of divisibility that a | (bx + cy).
Problem 7. (“The Cashier’s Error,” from The Moscow Puzzles by Boris A. Kordemsky, edited by
Martin Gardner.) The customer said to the cashier: “I have 2 packages of lard at 9 cents; 2 cakes
of soap at 27 cents; and 3 packages of sugar and 6 pastries, but I don’t remember the prices of the
sugar and pastries.”
“That will be $2.92.”
The customer said: “You have made a mistake.”
The cashier checked again and agreed.
How did the customer spot the error?
Solution. The prices of the lard and soap are both multiples of 3 cents, so the total price of the lard
and soap is also a multiple of 3 cents. The quantities of the sugar and pastries are both multiples
of 3, so the total price of the sugar and pastries must be a multiple of 3 cents. Therefore, the total
of everything at the end should also be a multiple of 3 cents. But it’s not, because 292 is not a
multiple of 3 (using the rule for divisibility by 3: 2 + 9 + 2 = 13 is not a multiple of 3, so neither
is 292). Therefore, the cashier must have made an error.
[This solution uses the “two out of three theorem,” Theorem 4.1(iii) on page 105 of Problem Solving
Through Recreational Mathematics, three times.]
Problem 8. Use the Euclidean algorithm to find the greatest common divisor of 11,238,781 and
8,476,873.
Solution. The process of the Euclidean algorithm is presented below in a table, in the same
way as the example in the “Additional topics in number theory” handout (available online at
http://www.math.cmu.edu/~bkell/21110-2010s/numbers.html).
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
1
2
4
2
4
2
4
2
4
2
4
2
4
2
3
c
d
r
11,238,781
8,476,873
11,238,781
8,476,873
2,761,908
8,476,873
2,761,908
8,476,873
2,761,908
191,149
2,761,908
191,149
2,761,908
191,149
85,822
191,149
85,822
191,149
85,822
19,505
85,822
19,505
85,822
19,505
7,802
19,505
7,802
19,505
7,802
3,901
7,802
3,901
7,802
3,901
0
gcd(11,238,781, 8,476,873) = 3,901
Therefore the greatest common divisor of 11,238,781 and 8,476,873 is 3,901.
Page 5
Problem 9. Investigate the powers of 2 (1, 2, 4, 8, 16, . . .) and classify them as abundant, deficient,
or perfect. Can you make a conjecture about these numbers? (Make your conjecture as specific as
you can.)
Solution. A table listing the first eight powers of 2, their proper divisors, the sums of their proper
divisors, and their classification as abundant, deficient, or perfect is given below.
Number
Proper divisors
Sum
Classification
1
2
4
8
16
32
64
128
(none)
1
1, 2
1, 2, 4
1, 2, 4, 8
1, 2, 4, 8, 16
1, 2, 4, 8, 16, 32
1, 2, 4, 8, 16, 32, 64
0
1
3
7
15
31
63
127
deficient
deficient
deficient
deficient
deficient
deficient
deficient
deficient
From this table we can make several conjectures.
Conjecture 1. The set of proper divisors of a power of 2 is the set of all smaller powers
of 2.
Conjecture 2. The sum of the proper divisors of a power of 2 is always one less than the
power of 2 itself.
Conjecture 3. Every power of 2 is deficient by exactly 1.
(Note that Conjecture 3 is just a rewording of Conjecture 2.)
[In fact all three of these conjectures are true. Conjecture 1 can be proved by considering the prime
factorization of a power of 2 (can you see how?). One way to prove Conjecture 2 is by using a
technique called mathematical induction, which we may talk about later in the course. And, of
course, if Conjecture 2 is true then Conjecture 3 must be true also.]
Problem 10. (From Mathematical Recreations and Essays by W. W. Rouse Ball and H. S. M.
Coxeter.) Prove that every sum of two consecutive odd primes is the product of three integers all
greater than 1. For example, 7 + 11 = 2 × 3 × 3, and 11 + 13 = 2 × 3 × 4.
Solution. Let p and q be two consecutive odd primes. (In other words, p and q are both odd
integers, they are both primes, and every integer strictly between p and q is composite.) Our goal
is to show that p + q can be written as the product of three integers all greater than 1.
Since p and q are both odd, their sum p+q is even. Therefore, p+q is divisible by 2, so (p+q)/2
is an integer. But (p + q)/2 is the average of p and q, which must be a number strictly between p
and q (because p 6= q). Hence (p + q)/2 must be composite (because p and q are consecutive primes).
So we can write (p + q)/2 as the product of two integers both greater than 1, say, (p + q)/2 = mn.
Thus, we can write the sum p + q as
p+q =2
p+q
2
= 2(mn),
so p + q is the product of 2, m, and n, each of which is an integer greater than 1.
[Note that this proof does not use the fact that p and q are themselves prime; it requires only that
p and q are both odd and that every integer between p and q is composite.]
Page 6
Problem 11. An eccentric sheep farmer has built an enclosure with four separate pens, as shown
below. In the center of the enclosure is a rather unusual four-sided gate. Whenever three sheep
enter the gate from three different sides, the fourth side of the gate opens and all three sheep enter
the fourth pen.
If there are initially 24, 28, 32, and 36 sheep in the four pens, respectively, is it possible that
after some time has passed there will be an equal number of sheep in each pen? What if there are
initially 12, 14, 16, and 18 sheep in the four pens, respectively? In each case justify your answer by
demonstrating how it can be done or by proving that it is impossible.
pen 1
gate
pen 2
pen 3
pen 4
Solution. Suppose there are initially 24, 28, 32, and 36 sheep in the four pens, so there are 120 sheep
in all. If there are to be an equal number of sheep in each of the four pens, there should be 30 sheep
in each. One of the pens must lose 6 sheep for this to happen. Each use of the gate can at best
decrease the number of sheep in this pen by 1, so we will need to use the gate at least 6 times.
If our goal is to equalize the number of sheep in each pen, one sensible strategy seems to be the
following: Find the pen with the least number of sheep (breaking ties arbitrarily), and move into it
one sheep from each of the other three pens. Repeat until all pens have the same number of sheep.
On the face of it, there seems to be no particular reason that this strategy should always work;
but if we try it on this specific example, it does work, and more impressively it is able to achieve
our goal with the minimum of 6 uses of the gate, as shown below.
24
+3
28
−1
32
−1
36
−1
27
+3
27
−1
31
−1
35
−1
30
−1
26
+3
30
−1
34
−1
29
+3
29
−1
29
−1
33
−1
32
−1
28
+3
28
−1
32
−1
31
−1
31
−1
27
+3
31
−1
30
30
30
30
Page 7
Now suppose there are initially 12, 14, 16, and 18 sheep in the four pens, so there are 60 sheep
in all. Our goal is to get 15 sheep in each pen. When we try to use the previous strategy, we are
repeatedly frustrated; it seems there is no way to do it. Can we prove that it is impossible?
Here is one such proof, using modular arithmetic. We shall consider the remainders when the
number of sheep in each pen is divided by 4. For brevity, we shall simply say “remainders” when
we mean the remainders after the number of sheep in each pen is divided by 4.
Let us consider how one use of the gate affects the remainders. Three of the remainders are
decreased by 1 (because three of the pens lose a sheep), while the other remainder is increased
by 3. But, modulo 4, adding 3 is the same as subtracting 1! For example, 2 − 1 ≡ 1 (mod 4) and
2 + 3 ≡ 1 (mod 4). So each use of the gate affects all four remainders the same way. If the four
remainders were equal before the gate was used, they will be equal after; and if they were unequal
before, they will be unequal after.
Initially we have 12, 14, 16, and 18 sheep in the four pens, so the remainders start at 0, 2, 0,
and 2. In particular, the starting remainders are unequal.
Our goal is to have an equal number of sheep in each pen; specifically, we want to have 15 sheep
in each pen. Since 15 ≡ 3 (mod 4), the remainders will all be 3. The important thing is that, in our
goal, all of the remainders are equal.
Since a use of the gate cannot change unequal remainders to equal remainders, there is no way
to achieve our goal of an equal number of sheep in each pen if we initially have 12, 14, 16, and 18
sheep in the four pens.
Page 8