from math import *
# compute phi^n in two ways:
# phif(n) computes it recursively,
# pow(phi,n) directly.
# starting around n = 36 the values start diverging dramatically
# the repeated substractions lead to catastrophic cancellation
phi = (sqrt(5)-1)/2
# the recusion is:
# phi^n = phi^{n-2} - phi^{n-1}
def phif(n):
p0 = 1
p1 = phi
for i in range (0,n):
temp = p1
p1 = p0 - p1
p0 = temp
return p0
for i in range(0,50):
print(i, pow(phi,i), phif(i), pow(phi,i)/phif(i))