next up previous
Next: High/Low Number Guessing Up: lab09 Previous: lab09

Fibonacci Sequence

The Fibonacci sequence as discussed in class arose in the 1200's when an Italian monk named Fibonacci studied reproduction of rabbits. The assumptions made were that
  1. you start with one pair,
  2. when rabbits reach the age of one month they are sexually mature,
  3. every birth results in a new male/female pair, and
  4. the rabbits never die.
Given this set of assumptions the recurrence relation for the number of rabbits at a given month m, is

2#2

Write a recursive function to calculate the value of F(m) for any given m. Add to this as the first statement a print statement to say what the argument was when it was called. Write a test program called Fibonacci.java, that will run the program and evaluate Fibonacci(8). In doing this how many calls are there to Fibonacci when the argument is 2?

Manton Matthews 2002-07-02