C__work_280sol4 - Solutions to Homework 4 March 4, 2007 The...

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

View Full Document Right Arrow Icon
Solutions to Homework 4 March 4, 2007 The following exercises are from Rosen. 2.4: 44 Since a b mod m , it follows that m | ( a - b ). Thus, there is a d such that ( a - b ) = dm . It follows that ( a - b ) c = dmc . Thus, mc | ( a - b ) c = ac - bc . So ac bc mod mc . 2.4: 46 Again, since a b mod m , it follows that m | ( a - b ). To show that gcd( a, m ) = gcd( b, m ), it suffices to show that CD ( a, m ) = CD ( b, m ). (Recall that CD ( a, b ) is the set of common divisors of a and b , and gcd( a, b ) is the largest element of CD ( a, b ).) So suppose that c CD ( a, m ). We want to show that c CD ( b, m ). Since c CD ( a, m ), c | a and c | m . Since m | ( a - b ), by the transitivity of divisibility, c | ( a - b ). Since c | ( a - b ) and c | a it follows that c | b . Since c | b and c | m , it follows that c CD ( b, m ). This shows that CD ( a, m ) CD ( b, m ). A completely symmetric argument shows that CD ( b, m ) CD ( a, m ). It follows that CD ( a, m ) = CD ( b, m ), as desired. 2.5: 20 First note that 123 = 22 mod 101 and 1001 is (1111101001) 2 (the subscript 2 means “in binary”). In the algorithm x is initially set to 1 and power is initally set to 22 (since 22 = 123 mod 101). We go through the loop in Algorithm 5 10 times, since 1001 has 10 digits when written in binary. Here are the successive values of x and power after each iteration through the loop, as we run the algorithm: x = 22; power = 22 × 22 = 80 mod (101) (since a 0 = 1 – a 0 is the last digit in the binary expansion of 1001) x = 22; power = 80 × 80 = 6400 = 37 mod (101) (since a 1 = 0) x = 22 mod 101; power = 37 × 37 = 1369 = 56 mod (101) (since a 2 = 0) x = 22 × 56 = 1232 = 20 mod 101; power = 56 × 56 = 3136 = 5 mod (101) (since a 3 = 1) x = 20 mod 101; power = 5 × 5 = 25 mod (101) (since a 4 = 0) 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
x = 20 × 25 = 500 = 96 mod 101; power = 25 × 25 = 625 = 19 mod (101) (since a 5 = 1) x = 96 × 19 = 1824 = 6 mod 101; power = 19 × 19 = 361 = 58 mod (101) (since a 6 = 1) x = 6 × 58 = 348 = 45 mod 101; power = 58 × 58 = 3364 = 31 mod (101) (since a 7 = 1) x = 45 × 31 = 1395 = 82 mod 101; power = 31 × 31 = 961 = 52 mod (101) (since a 8 = 1) x = 82 × 52 = 4264 = 22 mod 101; power = 52 × 52 = 2704 = 78 mod (101) (since a 9 = 1) So 123 1001 = 22 mod 1001. That was grungy. While the algorithm is good for computers, here’s a faster way of getting to the same place (which, unfortunately, was not acceptable as a solution to the problem, since it explicitly asked you to use the algorithm): Since 101 is prime, Fermat’s Little Theorem tells us that 123 100 mod 101 = 1, and thus 123 1000 = (123
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.

This note was uploaded on 09/04/2008 for the course CS 280 taught by Professor - during the Spring '07 term at Cornell University (Engineering School).

Page1 / 6

C__work_280sol4 - Solutions to Homework 4 March 4, 2007 The...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online