MATH 116 Homework 2 Solutions 1. Find the quotient and remainder of −200 divided by 19. Solution : We have that −200 = 19 · (−11) + 9. So the quotient (resp. remainder) of −200 divided by 19 is −11 (resp. 9). Although −200 = 19.(−10) − 10, this does not imply that the remainder of −200 divided by 19 is −10 since remainders are non-negative! 2. Convert (12345)6 from base 6 to decimal notation. Solution : We easliy get that (12345)6 = 5 · 60 + 4 · 61 + 3 · 62 + 2 · 63 + 1 · 64 = 5 + 24 + 108 + 432 + 1296 = 1865 3. Convert 2007 from decimal to base 7 notation. Solution : Repeatedly using the Division Algorithm, we find 2007 = 7 · 286 + 5 286 = 7 · 40 + 6 40 = 7 · 5 + 5 5=7·0+5 2007 = (5565)7 4. How many elements of the set S = {1, 2, . . . , 2012, 2013} are divisible by 3 but not by 5 nor 7? Solution : We have seen the following in class : If a and b are positive integers, then the number of positive integers smaller h a i than or equal to a that are divisible by b is the quotient of a divided by b, which turns out to be . b Let A (resp. B, C) be the set of elements in S that are divisible by 3 (resp. 5, 7). We have the following picture: A' ' $ $ B ' $ S &&%% & C 1 % We need to calculate |A \ (B ∪ C)|. We easily get that " # 2013 |A| = = 671 3 Note that A ∩ B = {s ∈ S | 3 divides s and 5 divides s} = {s ∈ S | 15 divides s} A ∩ C = {s ∈ S | 3 divides s and 7 divides s} = {s ∈ S | 21 divides s} A ∩ B ∩ C = {s ∈ S | 3 divides s, 5 divides s and 7 divides s} = {s ∈ S | 105 divides s} So " # " # 2013 2013 |A ∩ B| = = 134 , |A ∩ C| = = 95 15 21 " # 2013 and |A ∩ B ∩ C| = = 19 105 So |(A ∩ B) \ C| = 134 − 19 = 115 and |(A ∩ C) \ B| = 95 − 19 = 76 Hence |A \ (B ∪ C)| = 671 − (76 + 19 + 115) = 461 We have the following picture : A' ' $ $ B 461 115 $ ' 76 19 S &&%% & % C 5. Prove that (7a + 2, 3a + 1) = 1 for all a ∈ Z. Proof : Pick a ∈ Z. Put d = (7a + 2, 3a + 1). Then d|(7a + 2) and d|(3a + 1). Hence by Theorem 1.9, we get that d|[7(3a + 1) − 3(7a + 2)]. So d|1. Since d is positive we have that d = 1. 2 6. Let a ∈ Z. What is (2a, 3a − 1)? Solution : Put d = (2a, 3a − 1). Then d|(2a) and d|(3a − 1). Hence by Theorem 1.9, we get that d|[3 · (2a) − 2 · (3a − 1)] So d|2. Since d is positive, we have that d = 1 or d = 2. Since d ∈ {1, 2}, we get that d = 2 ⇐⇒ 2|(2a) and 2|(3a − 1) ⇐⇒ 2|(3a − 1) ⇐⇒ a is odd (2a, 3a − 1) = 2 1 2 if a is even if a is odd 7. Find all n ∈ N such that n3 − 1 is a prime. Solution : Suppose that n ∈ N such that n3 − 1 is a prime. Note that n3 − 1 = (n − 1)(n2 + n + 1) Since n − 1 > 0 and n2 + n + 1 > 0, and n3 − 1 is a prime, we must have that n−1=1 or n2 + n + 1 = 1 Hence n=2 or n=0 or n = −1 3 After checking, we get that n − 1 is a prime only if n = 2. n3 − 1 is a prime if and only if n = 2. 8. Let a, b, c ∈ Z, not all zero. Recall that the greatest common divisor of a, b and c (notation : (a, b, c)) is the largest integer that divides a and b and c. Prove that (a, b, c) = (a, (b, c)) by showing that {a, b, c} and {a, (b, c)} have the same common divisors. Proof : Let d be a common divisor of {a, b, c}. Then d|a, d|b and d|c. Note that (b, c) = bm + cn for some m, n ∈ Z by Bezout’s Theorem. So d|(b, c) by Theorem 1.9. Hence d is a common divisor of {a, (b, c)}. Let d be a common divisor of {a, (b, c)}. Then d|a and d|(b, c). Note that (b, c)|b and (b, c)|c by definition of greatest common divisor. Hence d|b and d|c by Theorem 1.8. So d is a common divisor of {a, b, c}. Since {a, b, c} and {a, (b, c)} have the same common divisors, they must have the same greatest common divisor. 2 9. This exercise is about writing integers in a negative base. (a) Let b ∈ Z with b < −1. Prove that every non-zero integer n can be written as n = ak bk + ak−1 bk−1 + · · · + a2 b2 + a1 b + a0 where ai ∈ {0, 1, . . . , |b| − 1} for 0 ≤ i ≤ k and ak 6= 0. You do not need to prove uniqueness. (b) Illustrate by writing 2013 in base b = −2. Proof : (a) We use induction on |n|. Suppose first that |n| = 1. Note that 1 = (1)b and −1 = (1, |b| − 1)b , which proves the base case. Suppose next that |n| > 1 and that any integer m with 1 ≤ |m| < |n| can be written in base b. Put n = bq + r where q, r ∈ Z and 0 ≤ r < |b|. Put a0 = r. If q = 0 then n = r = (a0 )b . So we may assume that q 6= 0. Since n = bq + r and 0 ≤ r ≤ |b| − 1, we get using the Triangle Inequality that n − r |n| + |r| |n| + |b| − 1 ≤ |q| = ≤ b |b| |b| So |q| < |n| ⇐⇒ |n| + |b| − 1 < |n| ⇐⇒ |n| + |b| − 1 < |b||n| ⇐⇒ 0 < (|b| − 1)(|n| − 1) |b| This last statement is true since |n| > 1 and |b| > 1. So |q| < |n|. By induction, q = cl bl + cl−1 bl−1 + · · · + c1 b + c0 3 where c0 , c1 , . . . , cl−1 , cl ∈ {0, 1, . . . , |b| − 1} and cl 6= 0. Then n = bq + r = b(cl bl + cl−1 bl−1 + · · · + c1 b + c0 ) + a0 = cl bl+1 + cl−1 bl + · · · + c1 b2 + c0 b + a0 which is of the required form. (b) To write an integer n in base b (with b < 0), we repeatedly use the Division Algorithm until the quotient becomes 0. The remainders are the digits a0 , a1 , a2 , . . .. 2013 −1006 503 −251 126 −63 32 −16 8 −4 2 −1 1 = = = = = = = = = = = = = (−2) · (−1006) + 1 (−2) · 503 + 0 (−2) · (−251) + 1 (−2) · 126 + 1 (−2) · (−63) + 0 (−2) · 32 + 1 (−2) · (−16) + 0 (−2) · 8 + 0 (−2) · (−4) + 0 (−2) · 2 + 0 (−2) · (−1) + 0 (−2) · 1 + 1 (−2) · 0 + 1 2013 = (1100000101101)−2 10. Let n ∈ N. Prove that n! + 1 has a prime divisor bigger than n. Deduce that there are infinitely many primes. Proof : Since n! + 1 > 1, it follows from Lemma 3.1 that n! + 1 has a prime divisor p. Suppose that p ≤ n. Since n! = 1 · 2 · 3 · · · (n − 2) · (n − 1) · n, we see that p|n!. Hence p|[(n! + 1) − n!] by Theorem 1.9. So p|1, a contradiction. Thus p > n. This proves that n! + 1 has a prime divisor bigger than n. Suppose now that there are only finitely many primes. Then there exists a largest prime, say P . But we just proved that P ! + 1 has a prime divisor bigger than P , a contradiction since P was the largest prime. 2 Hence there are infinitely many primes. 4