Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fibonacci Numbers (cont.) Pseudoprimes Shirley Moore CS 4390/5390 Fall 2013 September 12, 2013.

Similar presentations


Presentation on theme: "Fibonacci Numbers (cont.) Pseudoprimes Shirley Moore CS 4390/5390 Fall 2013 September 12, 2013."— Presentation transcript:

1 Fibonacci Numbers (cont.) Pseudoprimes Shirley Moore CS 4390/5390 Fall 2013 http://svmoore.pbworks.com/ September 12, 2013

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

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

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

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

6 Pseudoprimes An integer n is a b-pseudoprime if and n is not prime. Examples: b = 2, n = 341 b = 3, n = 671


Download ppt "Fibonacci Numbers (cont.) Pseudoprimes Shirley Moore CS 4390/5390 Fall 2013 September 12, 2013."

Similar presentations


Ads by Google