Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. The values in the Fibonacci sequence describe many natural phenomena. The mathematical definition of this sequence is u1-2 1 and un+1--1 (n> 2) Write

image text in transcribed

2. The values in the Fibonacci sequence describe many natural phenomena. The mathematical definition of this sequence is u1-2 1 and un+1--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. 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 yourprograun to determines 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? 2. The values in the Fibonacci sequence describe many natural phenomena. The mathematical definition of this sequence is u1-2 1 and un+1--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. 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 yourprograun to determines 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago