Fermat’s Little Theorem Fibonacci Numbers Shirley Moore CS4390/5390 Fall 2013 September 10, 2013 1.

Slides:



Advertisements
Similar presentations
Discrete Mathematics Lecture 3
Advertisements

Number Theory Algorithms and Cryptography Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms.
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson.
1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.
COMP 170 L2 Page 1 L06: The RSA Algorithm l Objective: n Present the RSA Cryptosystem n Prove its correctness n Discuss related issues.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Chapter 5 Number Theory © 2008 Pearson Addison-Wesley. All rights reserved.
CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
MS 101: Algorithms Instructor Neelima Gupta
Quotient-Remainder Theory, Div and Mod
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
1 The RSA Algorithm Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
CSC2110 Discrete Mathematics Tutorial 5 GCD and Modular Arithmetic
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Tuesday, 26 November Number-Theoretic Algorithms Chapter 31.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Complexity1 Pratt’s Theorem Proved. Complexity2 Introduction So far, we’ve reduced proving PRIMES  NP to proving a number theory claim. This is our next.
Discrete Structures Chapter 2 Part B Mathematical Induction
Announcements: HW3 updated. Due next Thursday HW3 updated. Due next Thursday Written quiz tomorrow on chapters 1-2 (next slide) Written quiz tomorrow on.
CSC 2300 Data Structures & Algorithms January 30, 2007 Chapter 2. Algorithm Analysis.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 7 Tuesday, 11/6/01 Number-Theoretic Algorithms Chapter.
DTTF/NB479: Dszquphsbqiz Day 9 Announcements: Homework 2 due now Homework 2 due now Computer quiz Thursday on chapter 2 Computer quiz Thursday on chapter.
Properties of the Integers: Mathematical Induction
CSE 321 Discrete Structures Winter 2008 Lecture 10 Number Theory: Primality.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Chapter 5 Number Theory © 2008 Pearson Addison-Wesley. All rights reserved.
 2012 Pearson Education, Inc. Slide Chapter 5 Number Theory.
Section 5.1 Number Theory.
Sequences and Series (T) Students will know the form of an Arithmetic sequence.  Arithmetic Sequence: There exists a common difference (d) between each.
COMP 170 L2 Page 1 L05: Inverses and GCDs l Objective: n When does have an inverse? n How to compute the inverse? n Need: Greatest common dividers (GCDs)
MATH 224 – Discrete Mathematics
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Section 4.3: Fermat’s Little Theorem Practice HW (not to hand in) From Barr Text p. 284 # 1, 2.
Advance Data Structure and Algorithm COSC600 Dr. Yanggon Kim Chapter 1.
Modular Arithmetic Shirley Moore CS4390/5390 Fall September 3, 2013.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Elements of Coding and Encryption Continuation 1.
RSA Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013.
Aim: Arithmetic Sequence Course: Alg. 2 & Trig. Do Now: Aim: What is an arithmetic sequence and series? Find the next three numbers in the sequence 1,
Copyright © Zeph Grunschlag, Basic Number Theory Zeph Grunschlag.
Lecture 4,5 Mathematical Induction and Fibonacci Sequences.
Fibonacci Numbers (cont.) Pseudoprimes Shirley Moore CS 4390/5390 Fall September 12, 2013.
Examining Fibonacci sequence right end behaviour
Fibonacci The Fibonacci Sequence The Golden Ratio.
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
The Euler-Fermat Theorem Our text calls this “Euler’s Formula”, but I prefer the above name, giving due credit to Fermat. Obvious question: Can Fermat’s.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Introduction to Number Theory
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
Computational Complexity Shirley Moore CS4390/5390 Fall 2013 August 27, 2013.
Recursive Sequences Terry Anderson. What is a Recursive Sequence? A sequence that follows a pattern involving previous terms  To generate new terms,
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
L131 Exponential Inverses Finding modular inverses is good enough for decoding simple modular cryptography. However, in RSA encryption consists of exponentiating.
Induction and Recursion CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Revision. Cryptography depends on some properties of prime numbers. One of these is that it is rather easy to generate large prime numbers, but much harder.
7.4 Exploring recursive sequences fibonacci
Section 5.1 Number Theory.
Patterns.
Numerical Algorithms x x-1 Numerical Algorithms
ALGORITHM NUMBER THEORY
Number-Theoretic Algorithms (UNIT-4)
Numerical Algorithms x x-1
Section 5.1 Number Theory.
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
Section 5.1 Number Theory.
Copyright © Zeph Grunschlag,
Divisibility and Modular Arithmetic
Induction: One Step At A Time
Presentation transcript:

Fermat’s Little Theorem Fibonacci Numbers Shirley Moore CS4390/5390 Fall September 10,

Agenda Fermat’s Little Theorem (20 min) Answer questions about homework (10 min) Fibonacci numbers (45 min) Wrapup (5 min) 2

Learning Outcomes After completing this lesson, you should be able to – State Fermat’s Little Theorem – Use Fermat’s Little Theorem to compute a large exponential in modular arithmetic – Use Fermat’s Little Theorem to prove a number is not prime – Write a Matlab function to compute a number sequence and analyze its runtime – Hypothesize and prove properties of a number sequence 3

Fermat’s Little Theorem First stated by Pierre de Fermat in 1640 First published proof by Leonhard Euler in 1736 Highly useful for simplifying the computation of exponents in modular arithmetic Corollary by Euler serves as the basis for RSA encryption Theorem: If p is a prime number and p does not divide a, then a p-1 1 (mod p) Example: p = 5 Proof: See Use FLT to find 3 100,000 (mod 53) 4

Use FLT to prove a number is composite without factoring it To prove n is composite, find some a such that a is not a multiple of n and a n-1 ≠ 1 (mod n). Is 91 a prime number? Try a = = 1 (mod 6), so is 6 prime? True or False: If b n-1 = 1 (mod n) for all b such that b is not a multiple of n, then n is prime. 5

Modular Arithmetic in Matlab upad_ug/modular-arithmetic.html upad_ug/modular-arithmetic.html mod mods powermod OK to use powermod for Problem 5 on Homework 1 See also 6

Fibonacci Sequence A man puts a pair of rabbits in a place surrounded on all sides by a wall. How many pairs of rabbits can be produced from that pair in a year if it is supposed that every month each pair begets a new pair which from the second month on becomes productive? --Leonardo Pisano Fibonacci, Liber Abaci, 1202 f n = f n-1 + f n-2 f 0 = 0, f 1 = 1 7

In-Class Exercises 1.Write a recursive Matlab function to compute the first n Fibonacci numbers. What is the time complexity of your algorithm? 2.Write an iterative Matlab function to compute the first n Fibonacci numbers. What is the time complexity of your algorithm? 3.Write a matrix formulation of the iterative algorithm. 8

Exercises (cont.) 4.Plot the first 25 Fibonacci numbers versus n. 5.Plot the first 25 Fibonacci numbers versus n on a semilog scale. 9

Greatest Common Divisor (GCD) of Fibonacci Numbers For m, n ≥ 1, gcd(f m,f n ) = f gcd(m,n) Proof: left as an exercise Example: f 34 = f 51 = What is gcd(f 34,f 51 ) ? Corollary 1: Two consecutive Fibonacci numbers are relatively prime. Corollary 2: F k divides evenly into F nk. 10

GCD of Fibonacci Numbers (cont.) Which Fibonacci numbers are even? Which Fibonacci numbers are multiples of 3? Which Fibonacci numbers are multiples of k? 11

Binet’s Formula where τ is the golden ratioand σ = -1/τ. Proof: by induction Corollary: F n equals the nearest integer to 12 Exercise: 6. How many digits are in F 1000 and what are the first few digits?

More Exercises 7.Investigate the ratio F n+1 /F n of consecutive Fibonacci numbers and try to identify the limit. 8.Investigate the sum F 0 + F 1 + … + F n. Find a formula for this sum and prove it by induction. 9.Investigate the numbers F n-1 x F n+1. Find a formula for this product and prove it. 10.Find all n between 1 and 100 for which F n is prime. Do you see any patterns? 13