CS284Exponentiation

CS284Exponentiation - 4 5 51 mod 7 i b i z 5 1 1 5 4 1 25...

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

View Full Document Right Arrow Icon
CSCI284 Spring 2009 GWU Efficient Exponentiation
Background image of page 1

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

View Full DocumentRight Arrow Icon
05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation 2 Efficient exponentiation (from Memon notes) Usual approach to computing x c mod n is inefficient when c is large. Example: 5 51 involves 50 multiplications mod n Instead, represent c as bit string b k-1 … b 0 and use the following algorithm: z = 1 For i = k-1 downto 0 do z = z 2  mod n    if b i  = 1 then z = z x  mod n How many multiplications? k = 2ceiling(log 2 c)
Background image of page 2
05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation 3 Example Calculate 5 51 mod 7 efficiently 51 = 110011 = 2 5 + 2 4 + 2 1 + 2 0 5 51 = ((((5 2 ) 2 ) 2 ) 2 ) 2 × (((5 2 ) 2 ) 2 ) 2 × 5 2 × 5 1 How many multiplications did you need?
Background image of page 3

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

View Full DocumentRight Arrow Icon
05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4 5 51 mod 7 i b i z 5 1 1 5 4 1 25 mod 7 = 4 20 mod 7 = 6 3 36 mod 7 = 1 1 2 1 1 1 1 1 5 1 25 mod 7 = 4 20 mod 7 = 6 05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation 5 Computational Complexity Computational complexity of the following operations on x ( k bit) and y ( l bit), k l : x + y x y xy Floor( x/y ) O( l(k-l )) gcd( x , y ) O( k 3 ) 05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation 6 Computational Complexity mod n Computational complexity of the following operations on mod n, where n is a k-bit integer: x + y x y xy x-1 x c c< n O(k 2 log c) = O(k 3 )...
View Full Document

This document was uploaded on 09/03/2010.

Page1 / 6

CS284Exponentiation - 4 5 51 mod 7 i b i z 5 1 1 5 4 1 25...

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

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