Intro to Number Theory: Solutions Dr. David M. Goulet November 14, 2007 Preliminaries Base 10 Arithmetic Problems • What is 7777 + 1 in base 8? Solution: In base 10, 7 + 1 = 8, but in base 7, 7 + 1 = 10. So 7777 + 1 = 7770 + 10 = 7700 + 100 = 7000 + 1000 = 10000. • In what base is 212 equal to 22510 ? Solution: call the base b. Then in base 10, (2 ∗ b + 1)2 = 225. So 2b + 1 = 15. Thus b = 7. • You ask your cyborg friend what it would like to eat. It replies “48,879”. Knowing that your cyborg friend thinks in hexidecimal but speaks in decimal, what should you feed it? Solution: It’s first useful to compute some powers of 16; 162 = 256, 163 = 4096, and 164 = 69632. Notice that this last power of 16 is larger than the given number, so we’ll only need 4 hexidecimal digits. The largest multiple of 4096 that can be subtracted from 48869 is 11, which in hexidecimal is B. This leaves 3823. The largest multiple of 256 which can be subtracted from this is 14, or E, which leaves 239. Continuing this, we find that out cyborg friend asked for “BEEF”. 1 Fundamental Theorem of Arithmetic Problems • Factor 120 uniquely into primes. Solution 120 = 2 ∗ 60 = 22 ∗ 30 = 23 ∗ 15 = 23 ∗ 3 ∗ 5. • Three inegers (x, y, z) satisfy 34x + 51y = 6z. If y and z are primes, what are these numbers? Solution: Writing 17(2x + 3y) = 6z shows that z is divisible by 17. Because z is a prime, we must have z = 17. We can now divide the whole expression by 17 to get 2x+3y = 6. Writing this as 3y = 2(3−x) shows that y is divisible by 2. Because y is a prime, y = 2. Finally x = 0. √ • Prove that p is an irrational number for any prime p. √ Solution: Suppose that p is a rational number. Then there exist two √ integers, n and m with no common divisor such that p = n/m. This shows that pm2 = n2 , so p must divide n2 . Just as the proof above for √ 2, this shows that p divides n which means that p2 divides n2 . This shows that p divides m2 , which again shows that p divides m. This is √ a contradiction, because m and n have no common divisors. So p is not rational. • Suppose that p is the largest prime number. Is p! + 1 divisible by any primes ≤ p ? Is this a contradiction? Solution: The number p! is divisible by all primes ≤ p. Can you see why? However, 1 isn’t divisible by any of these primes. So p! + 1 isn’t divisible by any primes ≤ p. But the fundamental theorem of arithmetic tells us that every number is either prime or divisible by primes. So, because p! + 1 isn’t divisible by any primes ≤ p, it must be divisible by some prime > p or it must itself be a prime. This is a contradiction, because p was assumed to be the largest prime. We conclude that there is no largest prime. 2 Divisibility Tests Divisibility by Powers of 2 Problems • Is 1, 234, 567, 890 divisible by 2? Solution: The last digit is 0, which is divisible by 2. So 1, 234, 567, 890 is divisible by 2. • Is 12113 − 1014 divisible by 2? Solution: Any number ending in 1, when raised to any power, still ends in 1. Can you see why? So both 12113 and 1014 end in 1. This means that their difference ends in 0, which is divisible by 2. So 12113 − 1014 is divisible by 2. • Prove that 178212 + 184112 6= 192212 . Do you know why your calculator is wrong? Solution: 17822 and 19222 are each divisible by 2, while 18412 is not. Can you see why? So the equation can’t be true. Your calculator is wrong because these numbers have over 40 digits and your calculator can’t accurately keep track of them all when computing the additions, subtractions, and roots. • How do you prove the 2n case? Solution: Notice that 100 is divisible by 4, that 1000 is divisible by 8 and that in general 10n is divisible by 2n . So, we can write any k digit number as m = dk dk−1 . . . d2 d1 = 10n (dk . . . dn+1 ) + dn dn−1 . . . d2 d1 . So m is divisible by 2n if and only if dn . . . d1 is. Divisibility by 3 and 9 Problems • Does the above proof also work for the case of divisibility by 9? Solution: Yes. As you can see, all of the terms that were described as being divisible by 3 are actually divisible by 9 as well. 3 • Is 1, 234, 567, 890 divisible by 3? Solution 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 = 45 and 45 is divisible by 3 because 4 + 5 = 9 and 9 is divisible by 3. • Is 3262 − 3252 divisible by 3? Solution: In algebra we learn about factoring the difference of two squares, x2 − y 2 = (x − y)(x + y). Using this formula here gives 3262 − 3252 = (326 − 325)(326 + 325) = (1)(651) = 651. This is divisible by 3 because 6 + 5 + 1 = 12. • Is 65, 314, 638, 792 divisible by 24? Solution: 6 + 5 + 3 + 1 + 4 + 6 + 3 + 8 + 7 + 9 + 2 = 54 and 54 is divisible by 3 because 5 + 4 = 9. So the number is divisible by 3. To check for divisibility by 8, we look at the last three digits, 792. This is divisible by 8 (792/8 = 99). So the number is divisible by both 8 and 3. So it must be divisible by 8 ∗ 3 = 24. Divisibility by Powers of 5 Problems • Is 1, 234, 567, 890 divisible by 5? Solution: The last digit is 0 which is divisible by 5, so the number is divisible by 5. • How many 3 digit numbers are divisible by 5? Solution: The only numbers divisible by 5 are numbers which end in 5 or 0. So we want to know how many numbers between 99 and 1000 end in a 5 or a 0. The first one is 100 and the last is 995, so there are 1 + (995 − 100)/5 = 180 such numbers. • Find a divisibility test for 125. Use your test to decide if 1, 234, 567, 890, 000 is visible by 750. Solution: Notice that 100 is divisible by 25, that 1000 is divisible by 125 and that in general 10n is divisible by 5n . We write any k digit number as m = dk . . . d1 = 10n (dk . . . dn+1 ) + dn . . . d1 . So a number is divisible by 5n if and only if it’s last n digits form a number which 4 is divisible by 5n . Because 750 = 2 ∗ 3 ∗ 53 , we check for divisibility by 2, 3, and 53 . The last digit is 0, so the number is divisible by 2. 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45 so the number is divisible by 3. The last three digits are 000 which is divisible by 125, so the number is divisible by 53 . So, the number is divisible by 750. • How do you test if a number is divisible by 5n ? Solution: See above. Divisibility by 7 Problems • Is 623 divisible by 7? Solution: 62 − 2 ∗ 3 = 56, and 56 is divisible by 7. So 623 is divisible by 7. • Is 1, 234, 567, 890 divisible by 7? Solution: At each step we remove the last digit, double it, and subtract it from what remains. 1234567890 123456789 12345660 1234566 123444 12336 1221 120 12 So the number is not divisible by 7. • Find a divisibility test for your favorite prime number. Solution: See the website for a document about this. 5 Divisibility by Powers of 10 Problems • Is 100110017 − 98125218092 divisible by 10? Solution: Any number ending in 1, when raised to any power, still ends in a 1. Can you see why? Any number ending in 9, when squared, also ends in 1. So the difference of the two numbers above ends in 0. So it is divisible by 10. • How many zeros are there at the end of the decimal representation of 25! ? If this number is written in binary (base 2), how many zeros are at the end of it? Can you think of a base in which this number has only 1 zero at the end of it? Solution Part 1: To know how many zeros 25! has, we need to know how many powers of 10 it is divisible by. To figure this out, let’s make a list of all the integers ≤ 25 which are divisible by either 2 or 5, {2, 4, 5, 6, 8, 10, 12, 14, 15, 16, 18, 20, 22, 24, 25}. Now, lets take this list and look at only the powers of 2 or 5 that it contains. The powers of two that each contains are {1, 2, 0, 1, 3, 1, 2, 1, 0, 4, 1, 2, 1, 3, 0}. So there are a total of 22 powers of 2. The powers of 5 that each of these number contain are {0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 2}. So the total number of powers of 5 is 6. The number 222 ∗ 56 ends in 6 zeros. Can you see why? So 25! ends in 6 zeros. Solution Part 2: If a number is divisible by 2 but not 4, then in binary, it ends in a zero. If a number is divisible by 4 but not 8, then in binary it ends in 00. In general, if a number is divisible by 2n but not 2n+1 , then in binary it end in a series of n zeros. Can you see why? Because we have shown that 25! is divisible by 222 but ot 223 , then in binary it ends in a series of 22 zeros. If we use the base 25!, then (25!)25! = 10, which ends in one zero. • If n is an integer, do n5 and n always have the same last digit? Solution: They both have the same last digit if and only if n5 − n ends in 0, or in other words, n5 − n is divisible by 10. Let’s check to see if this is true. If n is odd, then so is n5 . If n is even, then so is n5 . This shows that n5 − n is always even. Can you see why? So we only need t show that n5 − n is divisible by 5. By another problem below, np − n 6 is divisible by p whenever p is prime. Because 5 is prime, n5 − n is divisible by 5. We conclude that n5 − n is divisible by 10, so n5 and n always end in the same last digit. • Is there an integer, n, so that (n − 1)! + 1 is divisible by 10? Solution: The number (n − 1)! always ends in zero for any n ≥ 6. Can you see why? Because of this, (n−1)!+1 is not divisible by 10 if n ≥ 6. So we only need to check the value of (n − 1)! + 1 for n = {1, 2, 3, 4, 5}. The values are {2, 2, 3, 7, 25}, none of which are divisible by 10. So (n − 1)! + 1 is never divisible by 10. Divisibility by 11 Problems • Is 1001 divisible by 11? Solution: 1 − 0 + 0 − 1 = 0 which is divisible by 11, so 1001 is. • Is 1, 234, 567, 890 divisible by 11? Solution 1 − 2 + 3 − 4 + 5 − 6 + 7 − 8 + 9 = 5 which is not divisible by 11, so the number isn’t either. • Can the numbers {1, 2, 3, 4} be arranged into a four digit number that is divisible by 11? What about the numbers {1, . . . , 8}? Solution: Yes. 1 − 2 + 4 − 3 = 0 which is divisible by 11, so 1243 is. The key to this was creating a sequence of +1 and −1 that canceled, 1−2+4−3 = −1+1 = 0. Notice also that 1−2+4−3+5−6+8−7 = −1+1−1+1 = 0. So 12435687 is divisible by 11. Can you find others? • It’s easy to see that 1133 is divisible by 11. Using this, show very quickly that 3113 and 1, 001, 003, 003, 000 are also divisible by 11. Solution: Because 1 − 1 + 3 − 3 is divisible by 11, this divisibility isn’t effected if we just change the order of the two additions 3 − 1 + 1 − 3. Also, notice that the paris of zeros in 1001003003000 don’t effect the alternating sum of digits. So this number is divisible if 11330 is. But we know this is divisible by 11 because 1133 is. 7 • If a number has every one of its digits equal, under what conditions is that number divisible by 11? Solution: Suppose the number has n digits, all k’s. If n is even, then k − k + k − k + . . . + k − k = 0 is divisible by 11, so the number is. If n is odd, then k − k + k − k + . . . − k + k = k which is not divisible by 11. So a number whose digits are all the same is divisible by 11 if and only if it has an even number of digits. More Problems and Extra Stuff 1. Prove that any product of k consecutive positive integers is divisible by k. Solution: Every other integer is divisible by 2. Every third integer is divisible by 3. And similarly, every kth integer is divisible by k. In other words, between two consecutive multiples of k there are exactly k − 1 integers which are not divisible by k. Suppose that we have a product of k consecutive integers, none of which are divisible by k. This would imply that between two consecutive multiples of k there were at least k integers not divisible by k. This is a contradiction, because there are only k − 1 such numbers. So any product of k consecutive integers is divisible by k because one of these integers is a multiple of k. 2. If n is any integer, prove that n2 +n is always divisible by 2, that n3 −n is always divisible by 3, and that n5 − 5n3 + 4n is always divisible by 5. For a given prime number, p, can you find a polynomial expression like these that is always divisible by p? Solution: If we factor each of these polynomials we find, n2 + n = n(n + 1) n3 − n = n(n2 − 1) = (n − 1)n(n + 1) n5 − 5n3 + 4n = n(n2 − 1)(n2 − 4) = (n − 2)(n − 1)n(n + 1)(n + 2) So these polynomials represent the products of 2, 3, and 5 consecutive integers, respectively. So by the previous problem, they are divisible by 2, 3, and 5 respectively, whenever n is an integer. These factorizations suggest a way to produce a polynomial which is divisible by any 8 particualr prime p when n is an integer. Every prime > 2 is an odd number, p = 2m + 1. So we can form the polynomial f (n) = (n − m) . . . (n − 1)n(n + 1) . . . (n + m) = n(n2 − 1)(n2 − 4) . . . (n2 − m2 ) = n2m+1 − (1 + . . . + m2 )n2m + . . . + (m!)2 n 3. Prove that (p + 1)p − 1 is divisible by p2 if p is a prime number. Solution: p (p + 1) − 1 = p X k=0 = p X k=1 p = p p! pk − 1 k!(p − k)! p! pk k!(p − k)! X k=1 p−1 = p X k=0 p! pk−1 k!(p − k)! p! pk (k + 1)!(p − k − 1)! n! q!(n−q)! As proved below, is always an integer for 0 ≤ q ≤ n. So each term in the series is an integer. But we can do better than this. By p! an a problem above, p! is divisible by p. So not only is (k+1)!(p−k−1)! integer, but it is an integer divisible by p. Can you see why? So each term in the series is divisible by p. So (p + 1)p − 1 is divisible by p2 . 4. Prove that np −n is divisible by p if p is a prime number. This is known as Fermat’s Little Theorem. Solution: Notice that 1p −1 = 0 is divisible by p. We now use induction. Suppose that np − n is divisible by p for all 1 ≤ n ≤ N . Then p X p! p (N + 1) − (N + 1) = N k − (N + 1) k!(p − k)! k=0 p X = k=1 p−1 X = k=1 9 p! Nk − N k!(p − k)! p! N k + (N p − N ) k!(p − k)! As we have shown in other problems, the terms in the series are all integers divisible by p. Therefor the entire series is divisible by p. Also, we know that N p −N is divisibly by p. This shows that (N +1)p −(N +1) is divisible by p. So by induction np − n is divisible by p for all 1 ≤ n. The Binomial Theorem Problems • Check that n! k!(n−k)! = (n−1)! (k−1)!(n−k)! + (n−1)! . k!(n−k−1)! Solution: (n − 1)! (n − 1)! (n − 1)! 1 1 + = + (k − 1)!(n − k)! k!(n − k − 1)! (k − 1)!(n − k − 1)! n − k k n (n − 1)! = (k − 1)!(n − k − 1)! k(n − k) n! = k!(n − k)! • Use the previous problem (and to show that the coefficients induction) n! in the binomial expansion k!(n−k)! are always integers. n! Solution: Define C(n, k) = k!(n−k)! . Obviously C(1, 0) = C(1, 1) = 1 are both integers. As are C(2, 0) = C(2, 2) = 1 and C(2, 1) = 2. Let us assume that C(n, k) is an integer for all 1 ≤ n ≤ N − 1 and for (N −1)! 0 ≤ k ≤ n. This implies that C(N − 1, k − 1) = (k−1)!(N and −k)! (N −1)! C(N − 1, k) = k!(N are integers for 1 ≤ k ≤ N − 1. So their sum −k−1)! is also an integer. But, by the previous problem, their sum is C(N, k). So C(N, k) is also an integer for all 1 ≤ k ≤ N − 1. To complete the induction, we notice that C(N, 0) = C(N, N ) = 1 which are also integers. Thus C(n, k) is an integer for all 1 ≤ n ≤ N and 0 ≤ k ≤ n. So by induction, C(n, k) is an integer for all 1 ≤ n and 0 ≤ k ≤ n. 10