Continued Fractions, Euclidean Algorithm and Lehmer’s Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson TexPoint fonts used in EMF. Read the.

Slides:



Advertisements
Similar presentations
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson.
Advertisements

1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.
Cryptography and Network Security
Chapter 8 – Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other.
Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides.
CSE 311 Foundations of Computing I Lecture 13 Number Theory Autumn 2012 CSE
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
February 19, 2015Applied Discrete Mathematics Week 4: Number Theory 1 The Growth of Functions Question: If f(x) is O(x 2 ), is it also O(x 3 )? Yes. x.
Strong Implementation of Social Choice Functions in Dominant Strategies Clemens ThielenSven O. Krumke 3rd International Workshop on Computational Social.
CSCE 411 Design and Analysis of Algorithms Andreas Klappenecker TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAA.
Announcements: Homework 1 returned. Comments from Kevin? Homework 1 returned. Comments from Kevin? Matlab: tutorial available at
Chapter II. THE INTEGERS
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
WHOLE NUMBERS; INTEGERS Whole numbers: Z 0,+ = the natural numbers  {0}. Integers:
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
The Integers and Division
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
9/2/2015Discrete Structures1 Let us get into… Number Theory.
Mathematics of Cryptography Part I: Modular Arithmetic
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
MATH 224 – Discrete Mathematics
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Complexity of the Euclidean Algorithm (2/7) The complexity of an algorithm is the approximate number of steps necessary for the algorithm to finish as.
Recurrence Relation. Outline  What is a recurrence relation ?  Solving linear recurrence relations  Divide-and-conquer algorithms and recurrence relations.
Cryptography Inverses and GCD Piotr Faliszewski. GCD(a,b) gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b) a = b*q + r Here: q =  a / b  r = a mod b (a –
Introduction to Cryptography
Copyright © Zeph Grunschlag, Basic Number Theory Zeph Grunschlag.
YSLInformation Security -- Public-Key Cryptography1 Prime and Relatively Prime Numbers Divisors: We say that b  0 divides a if a = mb for some m, where.
Rational Numbers and Fields
CPSC 411 Design and Analysis of Algorithms
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
Network and Computer Security (CS 475) Modular Arithmetic
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Properties of the gcd Theorem: For any two integers a,b there exist integers x,y such that xa + yb = gcd(a,b). A proof will not be given at this point.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
Discrete Mathematics
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 3 Algorithms.
EXAMPLE 1 Find multiplicative inverses of numbers a. The multiplicative inverse of 1 5 – is – 5 because b. The multiplicative inverse of 6 7 – is 7 6 –
Applied Symbolic Computation1 Applied Symbolic Computation (CS 567) The Fast Fourier Transform (FFT) and Convolution Jeremy R. Johnson TexPoint fonts used.
Divisibility and Modular Arithmetic
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Direct Proof and Counterexample III Part 2 Lecture 16 Section 3.3 Tue, Feb 13, 2007.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
CSCE 411 Design and Analysis of Algorithms
Advanced Algorithms Analysis and Design
Introduction to Cryptography
Integers and Division Section 3.4.
Numerical Algorithms x x-1 Numerical Algorithms
CMSC Discrete Structures
CSE 311 Foundations of Computing I
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
September 4, 1997 Applied Symbolic Computation (CS 300) Dixon’s Algorithm for Solving Rational Linear Systems Jeremy R. Johnson.
Applied Symbolic Computation (CS 300) Modular Arithmetic
Foundations of Discrete Mathematics
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Applied Symbolic Computation (CS 300) Modular Arithmetic
Applied Symbolic Computation (CS 300) Modular Arithmetic
Algorithmic Number Theory and Cryptography (CS 303) Modular Arithmetic
Copyright © Zeph Grunschlag,
Applied Symbolic Computation (CS 300) Modular Arithmetic
Applied Symbolic Computation (CS 300) Modular Arithmetic
Applied Discrete Mathematics Week 10: Introduction to Counting
Applied Symbolic Computation (CS 300) Modular Arithmetic
Presentation transcript:

Continued Fractions, Euclidean Algorithm and Lehmer’s Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAA A A A

Outline Fast Fibonacci Continued Fractions Lehmer’s Algorithm Analysis of the Euclidean Algorithm (bit complexity) Assignment 1

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

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 l = q l  a l +1 gcd(a,b) = a l +1

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;

Lehmer’s Algorithm u = , v = u’ v’ q’ u’’ v’’ q’’ u’/v’ < u/v < u’’/v’’

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 < 2lg(a).

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. Theorem. Let a  b  0 and n = number of divisions required by the Euclidean algorithm to compute gcd(a,b). Then n < 1.44lg(a).

Average Number of Divisions Theorem. Let a  b  0 and n = average number of divisions required by the Euclidean algorithm to compute gcd(a,b). Then n  12ln(2) 2 /  2 lg(a)  lg(a). Theorem [Dixon] D(a,b)  ½ ln(a) for almost all pairs u  a  b  1 as u  

Dominance and Codominance Definition. Let f, g be real valued functions on a common set S. [Dominance] [Codominance] [Strict Dominance]

Basic Properties Theorem. Let f, f 1, f 2, g, g 1, and g 2 be nonnegative real-valued functions on S and c>0.

Integer Length Definition. A =  i=0..m a i  i, L  (A) = m

Basic Arithmetic Computing Times Theorem. Let A, M, D be the classical algorithms for addition, multiplication and division.

Maximum Computing Time Theorem.

Average Computing Time Theorem.

Probability of Relative Primality  p/d 2 = 1  p = 1/  (2)  (z) =  1/n z  (2) =  2 /6

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

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

Mobius Inversion  d|n  (d) = 0 (  n  (n)n s )  (  n 1/n s ) = 1

Formal Proof q n =  n  (k)  n/k  2 lim n  q n /n 2 =  n  (n)/n 2 = 1/(  n 1/n 2 ) = 6/  2

Assignment 1 Empirically investigate distribution of quotients in Euclidean algorithm Implement and analyze classical division algorithm Implement and analyze Lehmer’s algorithm Study and summarize gcd algorithms in GMP