where the function has problem? n = 900 is OK , but n = 1000 is ERROR
Billy Mays
81282ed9a88799d21e77957df2d84bd6514d9af6 at myhashismyemail.com
Mon Aug 1 10:00:57 EDT 2011
On 08/01/2011 05:11 AM, jc wrote:
> # Get Fibonacci Value
> # Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2)
> #
> # n = 900 is OK
> # n = 1000 is ERROR , Why
> #
> # What Wrong?
> #
I have fixed the problem for you:
def fibo(n):
phi = (1+5**.5)/2; iphi = 1-phi;
return (phi**n - iphi**n) / (5**.5)
--
Bill
More information about the Python-list
mailing list