Modular Arithmetic and Primality
Modular Arithmetic and Primality Modular Arithmetic and Primality
Is multiplication O(n 2 ) – Could we come up with a multiplication algorithm which is slower than O(n 2 ) – Know we can do at least this well, real question is can we come up with a faster one Is multiplication Θ(n 2 ) – In other words, is this the best we can do – Multiplication problem vs particular algorithms CS 312 - Complexity Examples - Arithmetic and RSA 16
Is multiplication O(n 2 ) – Could we come up with a multiplication algorithm which is slower than O(n 2 ) – Know we can do at least this well, real question is can we come up with a faster one Is multiplication Θ(n 2 ) – In other words, is this the best we can do – Multiplication problem vs particular algorithms Not Θ(n 2 ). It turns out we can do better, as we will see later – Can we prove lower bounds - Sometimes (e.g. addition) Division is also O(n 2 ) CS 312 - Complexity Examples - Arithmetic and RSA 17
- Page 1 and 2: Addition Multiplication Bigger Ex
- Page 3 and 4: Addition of two numbers of length n
- Page 5 and 6: Addition of two numbers of length n
- Page 7 and 8: Isn’t addition in a computer just
- Page 9 and 10: x y 15 11 At each step double x and
- Page 11 and 12: ⎧⎧ 2(x⋅ ⎣⎣y/2⎦⎦) if y
- Page 13 and 14: x y y binary # of x’s 15 8 0 1 30
- Page 15: function multiply(x,y) Input: Two n
- Page 19 and 20: Assume we start with numbers Mod N
- Page 21 and 22: There is a faster algorithm - Rathe
- Page 23 and 24: ⎧⎧ (x ⎣⎣y/2⎦⎦ ) 2 if y
- Page 25 and 26: x y y binary power of x z return va
- Page 27 and 28: function modexp (x, y, N) //Iterati
- Page 29 and 30: function primality(N) Input: Positi
- Page 31 and 32: How often does a composite number c
- Page 33 and 34: Primality testing is efficient! - O
Is multiplication O(n 2 )<br />
– Could we come up with a multiplication algorithm which is slower<br />
than O(n 2 )<br />
– Know we can do at least this well, real question is can we come up<br />
with a faster one<br />
Is multiplication Θ(n 2 )<br />
– In other words, is this the best we can do<br />
– Multiplication problem vs particular algorithms<br />
Not Θ(n 2 ). It turns out we can do better, as we will see<br />
later<br />
– Can we prove lower bounds - Sometimes (e.g. addition)<br />
Division is also O(n 2 )<br />
CS 312 - Complexity Examples - <strong>Arithmetic</strong> <strong>and</strong> RSA 17