Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

fabonacci numbers

jcherring4jcherring4 Posts: 2Member
[b][red]This message was edited by jcherring4 at 2007-3-12 2:25:42[/red][/b][hr]
Look guys i am new to this and got myself behind on this thing can i beg for some help here please help me with this program!!!!!
this is what the display should look like

1. Display the first 25 Fibonacci numbers
2. Display the first 50 Fibonacci numbers
3. Display the first 75 Fibonacci numbers
4. Display the first 125 Fibonacci numbers
5. Display the first 200 Fibonacci numbers

hit me back soon as you can please!
how pleaseeeee
help me with a starting point
read the material that i should have but cant get a start
a sample program could help if
that is not too much to ask
i am in a bind here



Comments

  • zibadianzibadian Posts: 6,349Member
    : [b][red]This message was edited by jcherring4 at 2007-3-12 2:25:42[/red][/b][hr]
    : Look guys i am new to this and got myself behind on this thing can i beg for some help here please help me with this program!!!!!
    : this is what the display should look like
    :
    : 1. Display the first 25 Fibonacci numbers
    : 2. Display the first 50 Fibonacci numbers
    : 3. Display the first 75 Fibonacci numbers
    : 4. Display the first 125 Fibonacci numbers
    : 5. Display the first 200 Fibonacci numbers
    :
    : hit me back soon as you can please!
    : how pleaseeeee
    : help me with a starting point
    : read the material that i should have but cant get a start
    : a sample program could help if
    : that is not too much to ask
    : i am in a bind here
    :
    :
    Start by reading about Fibonacci numbers (http://en.wikipedia.org/wiki/Fibonacci_numbers).
    Once you are familiar with those, you can start to write a function to find the n-th Fibonacci number. The easiest way to do this, is to check if n > 1 and write a loop from 2 to n which remembers the previous 2 numbers. Example:
    [code]
    Loop {
    previous2 = previous1
    previous1 = current
    current = previous1 + previous2
    }
    [/code]
    An alternative approach uses a recursive funcion:
    [code]
    function F(n);
    if n > 2 then {
    result = F(n-1)+F(n-2)
    } else if n = 1 then {
    result = 1
    } else {
    result = 0;
    }
    [/code]
  • SonickeaSonickea Posts: 15Member
    You won't get further than to the 46th fibonacci number using 32-bits ints (int), the next summation causes an overflow. For about 120 numbers I can only guess that 64-bit int (long) may hold, but for anything above that you need to use the BigInt class. The numbers expand very quickly.

    : : [b][red]This message was edited by jcherring4 at 2007-3-12 2:25:42[/red][/b][hr]
    : : Look guys i am new to this and got myself behind on this thing can i beg for some help here please help me with this program!!!!!
    : : this is what the display should look like
    : :
    : : 1. Display the first 25 Fibonacci numbers
    : : 2. Display the first 50 Fibonacci numbers
    : : 3. Display the first 75 Fibonacci numbers
    : : 4. Display the first 125 Fibonacci numbers
    : : 5. Display the first 200 Fibonacci numbers
    : :
    : : hit me back soon as you can please!
    : : how pleaseeeee
    : : help me with a starting point
    : : read the material that i should have but cant get a start
    : : a sample program could help if
    : : that is not too much to ask
    : : i am in a bind here
    : :
    : :
    : Start by reading about Fibonacci numbers (http://en.wikipedia.org/wiki/Fibonacci_numbers).
    : Once you are familiar with those, you can start to write a function to find the n-th Fibonacci number. The easiest way to do this, is to check if n > 1 and write a loop from 2 to n which remembers the previous 2 numbers. Example:
    : [code]
    : Loop {
    : previous2 = previous1
    : previous1 = current
    : current = previous1 + previous2
    : }
    : [/code]
    : An alternative approach uses a recursive funcion:
    : [code]
    : function F(n);
    : if n > 2 then {
    : result = F(n-1)+F(n-2)
    : } else if n = 1 then {
    : result = 1
    : } else {
    : result = 0;
    : }
    : [/code]
    :

Sign In or Register to comment.