Fibonacci Sequence and Long numbers.

Rob Hooft rob at hooft.net
Mon Oct 16 13:06:56 CEST 2000


from math import sqrt

def fib(n):
  return ((0.5+0.5*sqrt(5.0))**n-(0.5-0.5*sqrt(5.0))**n)/sqrt(5.0)

:-)

Rob
-- 
=====   rob at hooft.net          http://www.hooft.net/people/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========



More information about the Python-list mailing list