1 / 13

Fermat’s Little Theorem Fibonacci Numbers

Fermat’s Little Theorem Fibonacci Numbers. Shirley Moore CS4390/5390 Fall 2013 http://svmoore.pbworks.com/ September 10, 2013. Agenda. Fermat’s Little Theorem (20 min) Answer questions about homework (10 min) Fibonacci numbers (45 min) Wrapup (5 min). Learning Outcomes.

niles
Télécharger la présentation

Fermat’s Little Theorem Fibonacci Numbers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fermat’s Little TheoremFibonacci Numbers Shirley Moore CS4390/5390 Fall 2013 http://svmoore.pbworks.com/ September 10, 2013

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

  3. 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

  4. 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 ap-1 1 (mod p) • Example: p = 5 • Proof: See http://www.youtube.com/watch?v=w0ZQvZLx2KA • Use FLT to find 3100,000 (mod 53)

  5. 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 an-1 ≠ 1 (mod n). • Is 91 a prime number? Try a = 2. • 75 = 1 (mod 6), so is 6 prime? • True or False: If bn-1 = 1 (mod n) for all b such that b is not a multiple of n, then n is prime.

  6. Modular Arithmetic in Matlab • http://www.mathworks.com/help/symbolic/mupad_ug/modular-arithmetic.html • mod • mods • powermod • OK to use powermod for Problem 5 on Homework 1 • See also www.wolframalpha.com

  7. 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 fn = fn-1 + fn-2 f0 = 0, f1 = 1

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

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

  10. Greatest Common Divisor (GCD) of Fibonacci Numbers For m, n ≥ 1, gcd(fm,fn) = fgcd(m,n) Proof: left as an exercise Example: f34 = 5702887 f51 = 20365011074 What is gcd(f34,f51) ? Corollary 1: Two consecutive Fibonacci numbers are relatively prime. Corollary 2: Fk divides evenly into Fnk.

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

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

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

More Related