problems07-sol - procedure slow mod ( b ∶ integer , n, m...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
MATH S-104 Lecture 7 In-class Problem Solutions July 14, 2009 Problem 1 * : Prove that parts (i) and (ii) of Theorem 3.4.1 are true: (ii) if a b , then a bc for all integers c Since a b , there is some integer k such that b = ka . Thus bc = bka , so a bc . (iii) if a b and b c , then a c Since a b , b = ka . Since b c , c = mb . Thus, c = mka , so a c . Problem 2 : Below is a slow algorithm for doing modular exponentiation. Describe a modular exponentiation algorithm that has complexity O ( log n ) , where the exponent is represented as a binary expansion, as shown below. ± ² ³ ´ Algorithm 7.0: Slow modular exponentiation
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: procedure slow mod ( b ∶ integer , n, m ∶ positive integers) x ∶ = 1 for i ∶ = to n x ∶ = x ⋅ b mod m { x equals b n mod m } ± ² ³ ´ Algorithm 7.0: Fast modular exponentiation procedure fast mod ( b ∶ integer , n = ( a k-1 a k-2 . . . a 1 a 2 ) 2 , m ∶ positive integers) x ∶ = 1 power ∶ = b mod m for i ∶ = to k-1 if a i = 1 then x ∶ = ( x ⋅ power ) mod m power ∶ = ( power ⋅ power ) mod m { x equals b n mod m } 1...
View Full Document

This note was uploaded on 05/12/2010 for the course APPLIED ST 2010 taught by Professor Various during the Spring '10 term at Universidad Nacional Agraria La Molina.

Ask a homework question - tutors are online