comp.lang.ada
 help / color / mirror / Atom feed
From: brashear@ajpo.sei.cmu.edu (Philip Brashear)
Subject: Re: Fibonacci Numbers?
Date: Mon, 19 Sep 1994 22:47:16 EDT
Date: 1994-09-19T22:47:16-04:00	[thread overview]
Message-ID: <1994Sep19.224716.24513@sei.cmu.edu> (raw)
In-Reply-To: 35gii7$3ef@crl.crl.com

In article <35gii7$3ef@crl.crl.com> weiqigao@crl.com (Weiqi Gao) writes:
>In article <35fl28$1h3@garuda.csulb.edu>, S. Hegede <zoltan@csulb.edu> wrote:
>>
>>Hey!  I'm an a beginning Ada programmer and I've been stuck for a while
>>on trying to write a program in which a user can get the number in a
>>Fibonacci series( Ex.  1,1,2,3,5,8,13,21...) by typing its position in
>>the series.  I only need help on getting the formula down that would
>>calculate the next number in the series.  Thanks for the help.
>>.
>>
>>
>
>
>fib(n) = 1/sqrt(5) * [ ( 1 + sqrt(5))^n - ( 1 - sqrt(5))^n ] / 2^n.
>
>\/\/eiqi Gao
>weiqigao@crl.com


I'd be willing to bet that the assignment's intent was that the program
use the "standard" recursive definition of Fib:

  Fib (1) = 1
  Fib (2) = 1
  For N > 2, Fib (N) = Fib (N-1) + Fib (N-2)

At least that's where I always used the Fibonacci sequence: in showing
a non-trivial recursively defined function.

Phil Brashear



  parent reply	other threads:[~1994-09-20  2:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-17 20:54 Fibonacci Numbers? S. Hegede
1994-09-18  5:17 ` Weiqi Gao
1994-09-19 14:16   ` Robert I. Eachus
1994-09-20  2:47   ` Philip Brashear [this message]
1994-09-19 11:57 ` Robert Firth
1994-09-20  2:15 ` Keith Thompson @pulsar
1994-09-20 16:25   ` Robert Dewar
1994-09-21  0:57     ` David Weller
1994-09-23 16:33     ` Joseph Skinner
1994-09-23 20:55     ` Jeffrey J. Hallman
1994-09-20  6:36 ` pk
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox