{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS284Exponentiation

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

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

CSCI284 Spring 2009 GWU Efficient Exponentiation

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

View Full Document
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)
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?

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

View Full Document
05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation

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

View Full Document
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern