{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS284Exponentiation

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

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

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

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

View Full Document Right 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)
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?
Image of page 3

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

View Full Document Right Arrow Icon
05/15/09 CS284-162/Spring09/GWU/Vora/Exponentiation
Image of page 4
Image of page 5

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern