{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

s01 - Ma 450 Mathematics for Multimedia Solution to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ma 450: Mathematics for Multimedia Solution: to Homework Assignment 1 Prof. Wickerhauser Due Friday, February 5th, 2010 1. Suppose a divides 2 b and 2 b divides c . Must a divide c ? Solution: Yes. Rename B = 2 b and apply the transitive property of divisibility to a, B, c . 2. Write a computer program that finds the greatest common divisor of three positive integers a, b, c , assuming that the greatest common divisor function gcd(x,y) for any two positive integers x,y has already been implemented. Solution: Apply gcd(x,y) twice: Standard C Function: Greatest Common Divisor of Three Integers int gcd3 ( int a, int b, int c ) { a = gcd(a,b); return gcd(a,c); } 3. Suppose that a + b and a - b are relatively prime. Prove that a and b must be relatively prime. Solution: Since gcd( a + b, a - b ) = 1, by Theorem 1.2 there are integers x, y such that 1 = x ( a + b ) + y ( a - b ) = ( x + y ) a + ( x - y ) b . But then 1 is the smallest positive element of the set { ma + nb : m, n Z } , so gcd( a, b ) = 1 as in the proof of Theorem 1.2. 4. Find the greatest common divisor of the two numbers 123 456 789 and 12 345 678 901 234 567 890. Solution: The larger of these numbers is evidently a multiple of the smaller, so the greatest common divisor is just the smaller number, 123 756 789, by the fourth useful fact on page 4. 5. Is there an integer x such that 3702 x - 1 is divisible by 85? Solution: Yes. Such an x exists if there is a solution to the equation 3702 x - 1 0 (mod 85), or 3702 x 1 (mod 85). But gcd(3702 , 85) = 1, so by Lemma 1.6 such a quasi-inverse exists. We may use the extended Euclid algorithm to find the solution x = 38: (3702)(38) - 1 = 140675 = (85)(1655). 6. Suppose that - 2 30 < x < 0 and - 2 30 < y < 0 for integers x, y . Is it possible that the operation x + y causes integer underflow on a 32-bit twos complement computer? Solution: No. Integer underflow occurs on such a computer if and only if the sum of two rep- resentable negative numbers x, y gives the 32-bit twos complement representation of a nonnegative 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
number.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}