The following Python 3.0 script will work:
def f(i):
a, b = 0, 1
for i in range(i):
a, b = b, a + b
return a
print(f(0))
print(f(1))
print(f(2))
print(f(3))
print(f(1000))
Giving you:
0
1
1
2
and
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
3
solved Calculate the function of f(i) [closed]