Write a program called Fibonacci to print the first 20 Fibonacci numbers F(n), where F(n) = F(n–1)+F(n–2) and F(1)=F(2)=1. Also compute their average
Added by Barbara L.
Step 1
The Fibonacci numbers are defined as follows: - F(1) = 1 - F(2) = 1 - For n > 2, F(n) = F(n-1) + F(n-2) Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a R program to get the first 20 Fibonacci numbers.
Sri K.
Let FIB(n) be the nth term of the Fibonacci sequence, with Fib(1) = 1, Fib(2) = 1, Fib(3) = 2, and so on. a. Find Fib(20) b. Find Fib(25)
Adi S.
Consider the Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, .... The first two numbers are 1 and 1. When you add these numbers, you get 2 = 1+1, which becomes the third number in the sequence. When you add the second and third numbers, you get 3 = 1+2, which becomes the fourth number in the sequence. When you add the third and fourth numbers, you get 5 = 2+3, which becomes the fifth number in the sequence; and so on to generate the sequence. Write a short Excel program that generates the first 50 numbers of the Fibonacci sequence, using 1 and 1 as the first two numbers to start the sequence. Put these numbers in Column A in Excel. Also, in the next column in Excel (Column B), divide each number in the sequence by the previous number in the sequence. This column is a new sequence of numbers. Start Column B in Row 2. To what number does the sequence of the quotients in Column B converge? Use the 2-D Bar Chart tool in Excel to graph the first 10 ratios in Column B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD