Fibonacci Sequence and Long numbers.
Aahz Maruch
aahz at panix.com
Mon Oct 16 12:34:20 EDT 2000
In article <m2wvf9avu7.fsf at hooft.net>, Rob Hooft <rob at hooft.net> wrote:
>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)
That's fast, but of course it doesn't scale as well as Python longs.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"Isn't it interesting that the same people who laugh at science fiction
listen to weather forecasts and economists?" -- Kelvin Throop III
More information about the Python-list
mailing list