* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Module 4 Class Notes
Survey
Document related concepts
Mathematics of radio engineering wikipedia , lookup
Large numbers wikipedia , lookup
Series (mathematics) wikipedia , lookup
Approximations of π wikipedia , lookup
Positional notation wikipedia , lookup
Factorization of polynomials over finite fields wikipedia , lookup
Quadratic reciprocity wikipedia , lookup
Collatz conjecture wikipedia , lookup
List of prime numbers wikipedia , lookup
Elementary mathematics wikipedia , lookup
Elementary arithmetic wikipedia , lookup
Transcript
MATH4455 Module 4: A Thousand Points of Light Main Math Concepts: Prime Factorization, Divisors, Enumeration, Summation Auxiliary Ideas: Common factors, Uniqueness, Decimal notation for integers I. Counting Problem a ( the original “Thousand Points of Light”) A string of 1000 lamps, each with a simple on-off switch, are all off initially. 1000 people walk along the down the row of lights. Person #1 flips every switch. Person #2 flips the switches on lamps 2, 4, 6, ....., 1000.. Person #J flips every Jth lamp beginning with the Jth lamp. After all 1000 people have done their thing, which lamps are on and which are off? Solution. Looking at the first few lamps, lamp 1 is turned on by the first person and then never flipped again, so it is on at the end. Lamp 2 is flipped on by person #1 and flipped off by person 2 and never touched again, so it is off. Similarly, lamp 3 is flipped on by person #1, flipped off by person 3 and that’s it so it is off at the end. On the other hand lamp 4 is switched by persons #1, 2, and 4, so it is on at the end. If we look at it from the point of view of lamp n, then is flipped (on) by person 1, and then successively flipped off, on, off, ... by all persons j for which j is a divisor of n—the last flip of lamp n is by person n. So the number of flips of Lamp n equals the number of (positive) divisors of n, which we denote by ND(n). Now a lamp is on at the end if and only if it is flipped an odd number of times—so the lamps which are on at the end are those lamps n for which ND (n ) is odd (that is, those numbers n which have an odd number of divisors). For which numbers n is ND(n) an odd number? There is a simple way to see which numbers which have an odd number of divisors, based on the notion that given n, most divisors d of n come in pairs, namely the “twin” of divisor d is n/d which is also a divisor of n. Looking at an example like 72, its divisors come in pairs which multiply to 72, e.g. 1 x 72 = 2 x 36 = 3 x 24 = 4 x 18 = 6 x 12 = 8 x 9 and so there are 6 pairs of divisors, for a total of 12 which is of course even since they come in pairs. The only time this “pairing” fails is when n is a perfect square, since then the square root of n is a divisor and its “mate” is itself, so it does not get paired up. For example, with n = 36 we have 1 x 36 = 2 x 18 = 3 x 12 = 4 x 9 = 6 x 6 There are 5 products but only 4 pairs of unequal numbers due to the fact 36 is a perfect square. So we see that the positive integers for which ND(n) is odd are the perfect squares, and so the solution to the problem is: The lamps whose number is a perfect square (i.e. 1, 4, 9, 16, ... , 961) will be on at the end of the procession. Problem b. Find ND(35,000), that is, how many (positive) divisors does the number 35,000 have? Solution. First we try a couple of smaller numbers, say 7 and 200: Since 7 is prime, it has only 2 divisors, namely 1 and 7. For 200, we could just count them but that is impractical for large numbers so we write the prime factorization 200 = 2 35 2 and ask, what does the factorization of a divisor of 200 look like? Well, if k divides 200, then the primes in k can only be 2 and/or 5, and the power of 2 must be 3 or less, and the power of 5 must be 2 or less. So k must factor into 2 i 5 j with i ≤ 3 and j ≤ 2. How many such numbers k are there? We have 3+1 = 4 choices for i ( 0, 1, 2, or 3) and 2+1 = 3 choices for j ( 0, 1, 2) so altogether there are 4 x 3 =12 divisors of 200. Since there are only two prime factors of 200, we can display all 12 divisors (the shaded part) in a table in which the i-j th entry is 2 i 5 j : j↓ 0 1 2 i -> 2j 5j ↓ 1 5 25 0 1 1 2 2 4 3 8 1 5 25 2 10 50 4 20 100 8 40 200 Thus, the number of divisors of n depends only on the prime factorization of n, in fact, you can see that it only depends on the exponents in the prime factorization (not on the primes themselves). So, now for 35,000 = 2 35 4 71 . By the same reasoning we just did, a divisor of 35,000 must have the form k = 2 h 5 i 7 j with 0 ≤ h ≤ 3, 0 ≤ i ≤ 4, and 0 ≤ j ≤ 1 . Thus there are 4 x 5 x 2 = 40 divisors of 35,000. e e e In general, we can see that for an arbitrary integer n with prime factorization n = p1 1 p2 2 ...pk k where p1 ,...., pk are distinct primes, then e e e ND(n) = ND( p1 1 p2 2 ...pk k ) = (e1 + 1)(e2 + 1)...(ek + 1) --------------------------------------------------Relating this formula to the lamp problem, we could ask: when does ND(n) come out to be odd? Since ND(n) is a product of terms, it is odd if and only if each term ei + 1 is odd, which is to say, each e e e 2f 2f 2f f f f exponent e is even, say e = 2 f . Then n = p 1 p 2 ...p k = p 1 p 2 ...p k = ( p 1 p 2 ...p k )2 and i i i 1 2 k 1 2 k 1 2 k so n is a perfect square. Conversely, given that n is a perfect square, the same algebra shows that each exponent ei is even and then ND(n) is the product odd numbers, so it is odd. So we have ND ( n ) is odd if and only if all the prime exponents in n are even if and only if n is a perfect square. Problem c. Find ND (200) , ND (147), and ND (45). Then find ND (200 x 147) and ND (2000 x 45). Compare ND(mn) with ND(m) x ND(n) and explain what is going on. Solution. ND(200) = ND(2 35 2 ) = 4x3 = 12 ND(147) = ND(317 2 ) = 2x3 = 6, so ND(200)xND(147) = 12x6 = 72. ND(45) = ND(32 51 ) = 3x2 = 6, so ND(200)xND(45) = 12x6 = 72. ND(200x147) = ND(29400) = ND(2 35 2 317 2 ) = 4x3x2x3 = 72 = ND(200)xND(147) ND(200x45) = ND(9000) = ND(2 35 3 32 ) = 4x4x3 = 48 ≠ 72 = ND(200)xND(45) We can see that the primes that occur in 200 and in 147 are disjoint (that is, there are no primes which divide both numbers—equivalent to saying that 200 and 147 do not have a common factor), and hence the sequence of exponents factorization of 200x147 (namely 3,2,1,2) is just concatenates the exponents (3,2) from 200 and (1,2) from 147, and then the number of divisors of the product 200x147 ends up as just the product of the numbers of divisors of 200 and 147. In other words, it is because 200 and 147 are relatively prime (another way of saying that they do not have a common factor) that ND ( 200 x 147 ) = ND (200 ) x ND (147). In general, if m and n be relatively prime, then we can write their prime factorizations as f f f e e e m = p1 1 p2 2 ...pk k , n = q1 1 q2 2 ... ql l where pi ≠ q j for all i and j. So then the factorization of k l f e e e f f mn = p1 1 p2 2 ...pk k q1 1 q2 2 ... ql l and then ND(mn) = Π (ei + 1) Π ( f j + 1) = ND(m)ND(n) . i =1 j =1 Bottom Line: If m and n are relatively prime, then ND(mn) = ND(m)ND(n) . If m and n are not relatively prime, that is, they have a prime p in common (like 200 and 45 above have 5 in common), then we can not draw the same conclusion, since then the exponent sequence in mn is NOT the concatenation of the sequences from m and n—you can see from the example the exponent sequence (3,3,2) for 200x45 is not the concatenation of the sequences (3,2) and (2,1). In general, if m and n are not relatively prime (i.e. they have a common factor), then ND(mn) < ND(m)ND(n) , a fact which will be easy to see in the next section, when we consider sums of divisors. Problem d. Characterize those positive integers n for which 3 | ND( n ). Solution. First, the original 1000 points of light showed that 2 | ND (n) IFF n is not a perfect square, which as we saw above is equivalent to saying that at least one of the exponents in the prime factorization of n is odd. We’d like a similar characterization for divisibility by 3. e e e e e e Let n = p1 1 p2 2 ...pk k , and suppose 3 | ND(n) = ND( p1 1 p2 2 ...pk k ) = (e1 + 1)(e2 + 1)....(ek + 1) . Since 3 is prime, 3 | (e1 + 1)(e2 + 1)....(ek + 1) IFF 3 | (ei + 1) for some i IFF for some i, ei mod 3 = 2 Thus, 3 | ND( n ) if and only if at least one of the prime exponents in n is congruent to 2 mod 3. II. Summing. Problem a. Let SD(n) denote the sum of the divisors of n. Find SD( p k ) , where p is a prime, in closed form if possible, in terms of p and k. Solution. For example the divisors of 81= 34 are 1, 3, 9, and 81, so their sum is 1+3+9+81=94. In general, the only divisors of p k are powers of p less than or equal k, and so we have SD( p k ) = 1 + p + p 2 + ... + p k . Recalling the geometric sum formula, we can write this in closed form as SD( p k ) = 1 + p + p 2 + ... + p k = p k +1 − 1 . p −1 When p=2, then the denominator is 1 so SD(2 k ) = 1 + 2 + 4 + ... + 2 k = 2 k +1 − 1 . Another way to understand the geometric sum for powers of two is to ask the question: how many games are played in single elimination tournament with 2 J teams? For example if J = 6 as in the NCAA basketball tournament, there are 64 teams. The first round has 32 games, with 32 losers going home, 32 teams moving on. The next round has 16 games among the 32 winners from the first round, with 16 winners moving on to the next round, etc, until the final game. So the total number of games is the geometric sum 32 + 16 + .... + 2 + 1. Without adding up these numbers, nor using the geometric sum formula, it is easy to see that the sum must be 63, since each team in the tournament, except the final champion, loses exactly one game. Since each game has one loser, there must be 64 – 1 = 63 games all together. Obviously, this approach generalizes to the geometric sum formula 1 + 2 + 4 + ... + 2 J −1 = 2 J − 1 Problem b. Find SD(9), SD(35) and SD(15). Then find SD ( 9 x 35) and SD ( 9 x 15) and explain what is happening. Solution. 9 35 315=9x35 15 135=9x15 factorization 32 5171 32 x5x7 3151 3351 3 2x2=4 3x4=12 2x2=4 4x2=8 1,3,9 1,5,7,35 1,3,5,15 1,3,5,9,15,27,45,135 13 48 1,3,5,7,9,15,21,35 45, 63, 105, 315 624 24 240 ND divisors SD We notice that SD( 9 x 35 ) = 624 = 13 x 48 = SD (9) x SD (35), but a similar statement is false for 9 and 15. As we surely suspect at this point, it is all about 9 and 35 being relatively prime, while 9 and 15 are not. Consider the following table where we list the divisors of 9 down the side and those of 35 across the top, and take the products inside the shaded part of the table. b 1 5 7 35 Sum a 1 3 9 1 3 9 5 15 45 7 21 63 35 105 315 48 144 432 Sum 13 455 624 65 91 You can see that not only are there 3 x 4 =12 divisors of 9 x 35=315, but every entry in the table is one of those divisors, and moreover, each divisor of 315 occurs exactly once in the table, that is, each divisor d of 315 can be written uniquely as d = ab, where a is a divisor of 9 and b is a divisor of 35. Now, to see why the SD function is multiplicative for 9 and 35, just use the distributive law: SD(9) x SD(35) = 13 x 48 = (1 + 3 + 9) x (1 + 5 + 7 + 35) = (1x1 + 1x5 + 1x7 + 1x35) + (3x1 + 3x5 + 3x7 + 3x35) + (9x1 + 9x5 + 9x7 + 9x35) = SD (315) because each divisor of 315 occurs exactly once in among the products of divisors of 9 and of 35. Summary: Let m and n be relatively prime. Then: 1) each divisor d of mn can be written uniquely as the product of a divisor of m times a divisor of n, and every such product of a divisor of m and a divisor of n is also a divisor of mn. 2) ND (nm) = ND( m ) x ND ( n ) and SD (nm) = SD( m ) x SD ( n ). Finally we look at 9 x 15 =135 to see what happens with a pair integers having a common factor. We have made the same sort of table with the divisors of 9 and 15 along the side and top, and the products inside the shaded part. 1 3 5 1 3 9 1 3 9 3 9 27 5 15 45 Sum 13 39 65 15 Sum 15 45 135 24 72 216 195 312 Notice that again, all the divisors or 135 occur in the table, and every entry in the table is a divisor of 135, however we have lost the uniqueness—e.g. the numbers 3, 9, 15, and 45 occur twice in the table. As a result, the sum of the shaded entries, which does equal 13 x 24 = 312, is more than the sum of the divisors of 135 since those four divisors are counted twice in the table, so SD(135) < SD ( 9) x SD (15) Summary: Let m and n have a common factor. Then 1) Each divisor of mn can be written as a product of a divisor of m times a divisor of n, and every such product of a divisor of m and a divisor of n is a divisor of mn. However, some divisors of mn can be expressed as a product of divisors of m and n in more than one way. 2. ND (nm) < ND( m ) x ND ( n ) and SD (nm) < SD( m ) x SD ( n ). Problem c. 1000 empty garbage cans are lined up. 1000 people each have 1000 pebbles to throw away. Person #1 throws one pebble in each barrel, person #2 throws two pebbles in every 2nd barrel, .... person # j throws j pebbles in every jth barrel. Some people will have some left over pebbles (like person 998 will have two). At the end, how many pebbles are in barrel 720? Solution. By analogy with the lamp puzzle, we are looking for the sum of the divisors of 720, which factors as 720 = 2 4 x32 x5 . Then, by the two previous problems, we have SD(2 4 x32 x5) = SD(2 4 )SD(32 x5) = (1 + 2 + 4 + 8 + 16)SD(32 )SD(5) = 31(1 + 3 + 9)(1 + 5) = 2418. -------------------------------------------------------We note that the same reasoning gives the general formula for SD (n) in terms of its factorization: e e e Let n = p1 1 p2 2 ...pk k be the prime factorization of n, then k k SD(n) = Π (1 + pi + pi 2 + ... + pi i ) = Π i =1 e i =1 pi ei +1 −1 . pi − 1 III. Digging Digits. Problem a. Let s(n) denote the sum of the decimal digits on the positive integer n. Explain why n - s(n) is divisible by 9. Then use this to explain why n is divisible by 9 if and only if s(n) is divisible by 9.. k Solution. Given n, let the digits of n be ak ak −1 ...a1a0 , so n = ak 10 k + ak −110 k −1 + ... + a110 + a0 = ∑ ai 10 i . i=0 k Then s(n) = ak + ... + a1 + a0 = ∑ ai and so n − s(n) = ∑ ai 10 i − ∑ ai = ∑ (ai 10 i − ai ) = ∑ ai (10 i − 1) . i=0 Now 10 i − 1 looks like 999...9 (there are ( i – 1) digit nines), so it is obviously divisible by 9 with quotient 111...1. So we have 10 i − 1 = 9bi . Thus, we have n − s(n) = ∑ ai (10 i − 1) = ∑ ai (9bi ) = 9∑ ai bi and so n - s(n) is divisible by 9. For the second part, for any n, we can write n - s(n) = 9k (by what we just showed). If n = 9j, then s(n) = n − 9k = 9 j − 9k = 9( j − k) so s(n) is divisible by 9. Conversely, if s(n) = 9i , then n = s(n) + 9k = 9i + 9k = 9(i + k) so n is divisible by 9. ---------------------------Problem b. (the jumble circle trick) Explain how the following trick is done, and why it works. Pick a number (positive integer) with at least two different digits in it (e.g. not 3333). Jumble up the digits to make a new number, then subtract the smaller from the larger. Circle one of the digits in your answer, but do not circle 0 (“since it is already a circle”). Read off the non-circled digits to me in any order you like. Magically, I tell you the digit which you circled. Solution The method for doing the trick is simply: Add up the digits which are read to you, and subtract from the next higher multiple of 9. The result is the circled digit. Examples. The subject reads off 6, 9, 5. The sum is 20, 27 - 20 = 7, so 7 was circled. The subject reads off 4, 4, 2, 4. The sum is 14, 18 – 14 = 4, so 4 was circled. The subject reads off 3, 1, 5. The sum is 9, 18 - 9 = 9, so 9 was circled. So obviously the sum of the digits in the computed number must be multiple of 9, which explains why the trick must not allow you to circle 0—you cannot distinguish circling 0 from circling 9. Why does it work? That is a homework problem. -----------------------------------------------------By the way there is a web implementation of this trick at http://www.digicc.com/fido/ .