Computer

posted by .

How to write an algorithm to find the fibonacci series ???

Help:/

  • Computer -

    The fibonacci series is defined as the set of terms a(n)∈Z+ (i.e. all terms are integers) such that:
    a(0)=0
    a(1)=1
    a(i)=a(i-2)+a(i-1), i≥2

    The pseudocode resembles a lot the definition of the series:

    Input: n
    a(0)=0
    a(1)=1
    for i=2,i<=n,i++: a(i)=a(i-2)+a(i-1) next
    return a(n)


    Note that a closed form formula for evaluating a(n) exists, and is called the Binet's formula:
    a(n)=((p^n-(-1/p)^n)/sqrt(5)
    where p=(1+sqrt(5))/2 = the golden ratio

    However, since the result has to be an integer, and the calculations required are real, there could be rounding problems with calculations performed on a digital computer, unless symbolic algebra is available.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Pre-Calc

    Find three examples of the Fibonacci sequence in nature. Write a paragraph for each example. For each example, address the following questions: How does the example relate to the Fibonacci sequence?
  2. Quantum Physics

    In this problem, we will carry out some steps of the quantum factoring algorithm for N = 15 (a) What is the period k of the periodic superposition set up by the quantum factoring algorithm if it chooses x = 2 ?
  3. physics

    n this problem, we will carry out some steps of the quantum factoring algorithm for N=15. (a) What is the period k of the periodic superposition set up by the quantum factoring algorithm if it chooses x=2?
  4. Math (fibonacci

    A sequence of numbers is called a Fibonacci-type sequence if each number (after for the first two) is the sum of the two numbers which precede it. For example, 1, 1, 2, 3, 5, 8 ... is a Fibonacci- type sequence. If 1985, x, y, 200 …
  5. computer

    write an algorithm , draw a flowchart and write a program to calculate the total amount if a child buys 20 pens at rs20each , 30 pencils at rs2 each and 40 erasers at rs5 -***********eac-h
  6. computer

    Write an algorithm for a program that accepts a set of numbers and finds the smallest among them and computes the sum of the numbers accepted. The program stops when the user enters number 999. Convert the algorithm into flowchart
  7. computer

    draw a flowchart and write the algorithm for printing the first 10 even numbers
  8. Computer

    Write an algorithm and flowchart that will accept 30 students calculate and print the average mark in basic program.
  9. computer science

    draw a flowchart and write the algorithm for printing the first 10 even numbers
  10. computer

    Write an algorithm to enter marks of three subject for 100 students and find average and percentage if age is greater than 20 and less than 25

More Similar Questions