On Tue, Jul 31, 2001 at 11:59:07AM +0500, Saquib Farooq wrote:
> hi
>       well first of all you have to remove the colon -- ";" sign from
> the end of your while loop ...... that will solve the problem for the time
> out.
>       then there is problem with your code, this code will never get you
> the fibonacci since the variable a,b and c never go abone 0, see. :).

Just in case anyone is interested... If you want to find the n'th
Fibonacci number and not go through the entires sequence, you can
use the formula:

F(n) = ( P^n - (-P)^(-n) ) / sqrt(5) where P = (1 + sqrt(5))/2

and it's also possible to extend Fibonacci numbers to negative n.
Pretty fascinating (:

Also, if you have F(n) you can find F(n+1). Let x denote F(n).

F(n+1) = floor( (x + 1 + sqrt(5x^2)) / 2).


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to