im trying to create a function that identifies if a number is a Fibonacci numbers base on:
Fibonacci number - Wikipedia, the free encyclopedia
here is what i did
import math gratio = (1 + math.sqrt(5))/2#golden ratio lim = 10**999 #math.log(x[, base]) def isFibon(x):#test if number is a Fibonacci numbers if (math.log(math.sqrt(5*x),gratio) + 0.5) == x: return 1 else: return 0 for n in range(20): if isFibon(n) == 1: print nand hear id what i got
Traceback (most recent call last):
File "untitled.py", line 15, in <module>
if isFibon(n) == 1:
File "untitled.py", line 9, in isFibon
if (math.log(math.sqrt(5*x),gratio) + 0.5) == x:
OverflowError: math range error
im planning on using another method but im still curious what all this mean
any help will be appreciated


Sign In
Create Account


Back to top









