The values in the Fibonacci sequence describe many natural phenomena. The mathematical definition of this sequence is
Question:
The values in the Fibonacci sequence describe many natural phenomena. The mathematical definition of this sequence is
U1 = U2 = 1 and Un+1 = Un + Un-1 (n > 2)
Write a program that uses a while loop to calculate and print out successive terms of this sequence until the value of the next term exceeds some number N, where N is an integer entered by the user. You should also upload the final MatLab program to http://d21.arizona.edu. Test your program on the following problem: Suppose we place a pair of newborn rabbits in a large pen, and the nature of these rabbits is such that, starting in their second month of life, they are able to breed and produce one new pair of rabbits every month thereafter. Thus at the end of the first month we have 1 pair, at the end of the second month 1 pair, at the end of the third month 2 pairs, at the end of the fourth month 3 pairs, at the end of the fifth month 5 pairs, and so on. (This was the original problem considered by Fibonacci in his book Liber Abaci, written in 1202). Use your program to determine:
1. By the end of which month will the total number of pairs of rabbits exceed 200?
2. By the end of which month will the total number of pairs of rabbits exceed 20,000?