{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

a3-27-08

# a3-27-08 - Section 34 1 For the pairs of integer a b given...

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

Section 34 1. For the pairs of integer a , b q and r such that a = qb + r and 0 r < b (a) a = 100 and b = 3 . q = 33 and r = 1 . (b) a = ± 100 and b = 3 . q = ± 34 and r = 2 . (c) a = 99 and b = 3 . q = 33 and r = 0 . (d) a = ± 99 and b = 3 . q = ± 33 and r = 0 . (e) a = 0 and b = 3 . q = 0 and r = 0 . There is only one correct answer to each of these. 2. For each of the pairs of integers a , b in the previous problem, compute a div b and a mod b . This is the same question, except you have to know what a div b and a mod b are. In fact, a div b is the q a mod b is the r . So, for example, the answer to (b) is that ± 100 div 3 = ± 34 and ± 100 mod 3 = 2 . Section 35 1. Please calculate: (a) gcd (20 ; 25) When the two numbers are positive integers, I like to arrange this computation as follows. Start out with the two numbers 20 and 25 in descending order: 25 , 20 Then compute 25 mod 20 = 5 to get 25 , 20 , 5 1

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

View Full Document
Then compute 20 mod 5 = 0 . That tells you that 5 = gcd (20 ; 25) . At each step you compute x mod y where x and y are the last two numbers in your list. You stop when x mod y = 0 , at which point y is the desired greatest common divisor. (b) gcd (0 ; 10) When one of the numbers is 0 use the fact that gcd (0 ; b ) = b for any integer b . So gcd (0 ; 10) = 10 . (c)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

a3-27-08 - Section 34 1 For the pairs of integer a b given...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online