Download presentation

Presentation is loading. Please wait.

Published bySeth Craner Modified over 2 years ago

1
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson

2
Greatest Common Divisors g = gcd(a,b) – g|a and g|b – e|a and e|b e|g

3
Unique Factorization p|ab p|a or p|b a = p 1 p t = q 1 q s s = t and i j: p i = q j a = p 1 e1 p t et b = p 1 f1 p t ft gcd(a,b) = p 1 min(e1,f1) p t min(et,ft)

4
Bezout’s Identity g = gcd(a,b) x,y: g = ax + by

5
Bezout’s Identity g = gcd(a,b) x,y: g = ax + by

6
Euclidean Algorithm g = gcd(a,b) if (b = 0) then return a; else return gcd(b,a mod b)

7
Correctness

8
Tail Recursion g = gcd(a,b) if (b = 0) then return a; else return gcd(b,a mod b)

9
Iterative Algorithm g = gcd(a,b) a1 = a; a2 = b; while (a2 0) a3 = a1 mod a2; a1 = a2; a2 = a3; } return a1;

10
Remainder Sequence a 1 = a, a 2 = b a 1 = q 3 a 2 + a 3, 0 a 3 < a 2 a i = q i a i+1 + a i+2, 0 a i+2 < a i+1 a n = q n a n+1 gcd(a,b) = a n+1

11
Bounding Number of Divisions Theorem. Let a b 0 and n = number of divisions required by the Euclidean algorithm to compute gcd(a,b). Then n < 2lg(a).

12
Bounding Number of Divisions

13
Fibonacci Numbers F 0 = 0, F 1 = 1 F n+2 = F n+1 + F n

14
Solving the Fibonacci Recurrence F n = 1/ 5( n + * n ), = (1 + 5)/2, * = (1 - 5)/2 F n 1/ 5 n+1

15
Solving the Fibonacci Recurrence

17
Maximum Number of Divisions Theorem. The smallest pair of integers that require n divisions to compute their gcd is F n+2 and F n+1.

18
Maximum Number of Divisions Theorem. Let a b 0 and n = number of divisions required by the Euclidean algorithm to compute gcd(a,b). Then n < 1.44 lg(a).

19
Maximum Number of Divisions

20
Extended Euclidean Algorithm g = gcd(a,b,*x,*y) a1 = a; a2 = b; x1 = 1; x2 = 0; y1 = 0; y2 = 1; while (a2 0) a3 = a1 mod a2; q = floor(a1/a2); x3 = x1 – q*x2; y3 = y1 – q*y2; a1 = a2; a2 = a3; x1 = x2; x2 = x3; y1 = y2; y2 = y3; } return a1;

21
Correctness

23
Probability of Relative Primality p/d 2 = 1 p = 1/ (2) (z) = 1/n z (2) = 2 /6

24
Formal Proof Let q n be the number of 1 a,b n such that gcd(a,b) = 1. Then lim n q n /n 2 = 6/ 2

25
Mobius Function (1) = 1 (p 1 p t ) = -1 t (n) = 0 if p 2 |n (ab) = (a) (b) if gcd(a,b) = 1.

26
Mobius Inversion d|n (d) = 0 ( n (n)n s ) ( n 1/n s ) = 1

27
Formal Proof q n = n n/k 2 lim n q n /n 2 = n (n)n 2 = n 1/n 2 = 6/ 2

Similar presentations

Presentation is loading. Please wait....

OK

Chapter II. THE INTEGERS

Chapter II. THE INTEGERS

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on javascript events onkeydown Ppt on elements and compounds Ppt on stages of group development Ppt on inside our earth for class 7 Ppt on media and networking Ppt on rural development schemes in india Ppt on astronomy and astrophysics colleges Download ppt on recruitment and selection process of infosys Ppt on aerobics step Ppt on disaster management act 2005