one-file-projects/fibonacci_small.py

7 lines
142 B
Python
Raw Normal View History

2014-08-31 06:14:41 +02:00
from math import sqrt
psi = (1+sqrt(5))/2
phi = 1/sqrt(5)
fib = lambda k: int(phi*(psi**k - (-1/psi)**k))
for i in range(100):
print(fib(i))