Math 240 Name: Worksheet Week 10 Mar 2017 TA: Amy Huang Section 4.2 Problem 22: Find the sum and product of each of these pairs of number. Express your answer as a base 3 expansion. 1. (112)3 , (210)3 2. (2112)3 , (12021)3 3. (20001)3 , (1111)3 4. (120021)3 , (2002)3 Solution: 1. Sum:(1022)3 , Product:(101220)3 2. Sum:(21210)3 , Product:(110020022)3 3. Sum:(21112)3 , Product:(22221111)3 4. Sum:(122100)3 , Product:(1011122112)3 Section 4.2 Problem 37: One’s complement representations of integers are used to simplify computer arithmetic. To represent positive and negative integers with absolute value less than 2n−1 , a total of n bits is used. The leftmost bit is used to represent the sign. A 0 bit in this position is used for positive integers, and a 1 bit in this position is used for negative integers. For positive integers, the remaining bits are identical to the binary expansion of the integer. For negative integers, the remaining bits are obtained by first finding the binary expansion of the absolute value of the integer, and then take the complement of each of these bits, where the complement of a 1 is a 0 and the complement of a 0 is a 1. How is one’s complement representation of the sum of two integers obtained from one’s complement representation of these integers? (Hint: If you get stuck, try to compute one’s complement representation of the following pairs of integers and take n = 4. Then sum them up as usual. And compare your result with one’s complement representation of the sum of those two integers. 1. −1, −1 2. 5, −2 3. 2, −5 ) Solution: One’s complement of a negative integer −x for 0 ≤ x < 2n−1 is represented by the number 2n − x − 1. So the one’s complement of the sum is found by adding the one’s complements of the two integers except that a caary in the leading bit is used as a carry to the last bit of the sum. Section 4.3 Problem 18: divisors other than itself. We call an integer perfect if it equals the sum of its positive 1. Show that 6 and 28 are perfect. 2. Show that 2p−1 (2p − 1) is a perfect number when 2p − 1 is prime. Solution: 1. Positive divisors of 6 other than 6 are 1, 2, 3. And 1 + 2 + 3 = 6. Hence 6 is perfect. Similarly, 1 + 2 + 4 + 7 + 14 = 28. So 28 is perfect. 2. The positive divisor other than itself of 2p−1 (2p − 1) are 1, 2, 22 , . . . , 2p−1 , 2p − 1, 2(2p − 1), . . . , 2p−2 (2p − 1). Using sum of geometric number, we know that 1 + 2 + . . . + 2p−1 = 2p − 1 2p − 1 + 2(2p − 1) + . . . + 2p−2 (2p − 1) = (2p−1 − 1)(2p − 1) Therefore the sum of all positive divisors are (2p − 1) + (2p−1 − 1)(2p − 1) = 2p−1 (2p − 1) and 2p−1 (2p − 1) is perfect. Section 4.3 Problem 32: Use the Euclidean algorithm to find 1. gcd(1, 5) 2. gcd(100, 101) 3. gcd(123, 277) 4. gcd(1529, 14039) 5. gcd(1529, 14038) 6. gcd(11111, 111111) Solution: 1. gcd(1, 5) = 1 2. gcd(100, 101) = gcd(100, 1) = 1 3. gcd(123, 277) = gcd(123, 31) = gcd(30, 31) = gcd(30, 1) = 1 4. gcd(1529, 14039) = gcd(1529, 278) = gcd(139, 278) = 139 5. gcd(1529, 14038) = gcd(1529, 277) = gcd(144, 277) = gcd(144, 133) = gcd(11, 133) = gcd(11, 1) = 1 6. gcd(11111, 111111) = gcd(11111, 1) = 1 Section 4.3 Problem 49: Prove that the product of any three consecutive integers is divisible by 6. Solution: The product of any two consecutive integers is divisible by 2 and the product of any three consecutive integers is divisible by 3. So 2|n(n + 1)(n + 2) and 3|n(n + 1)(n + 2). Since gcd(2, 3) = 1, we have 6|n(n + 1)(n + 2). Section 4.4 Problem 5: prime integers: Find an inverse of a mod m for each of these pairs of relatively 1. a = 19, m = 141 2. a = 55, m = 89 3. a = 89, m = 232 Solve the following congruences using the modular inverse you found: 1. 19x ≡ 4(mod 141) 2. 55x ≡ 34(mod 89) 3. 89x ≡ 2(mod 232) Solution: 1. 52 2. 34 3. 73 4. x = 67 5. x = 88 6. x = 146
© Copyright 2026 Paperzz