public
Last active

  • Download Gist
fibonacci.py
Python
1 2 3 4 5 6 7 8 9 10 11 12
cpdef int fib(int n):
if n == 2:
return 2
elif n < 0:
raise NotImplementedError
elif n <= 1:
return 1
else:
return fib(n-1) + fib(n-2)
 
if __name__ == '__main__':
print(fib(40))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.