Instantly share code, notes, and snippets.

Embed
What would you like to do?
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))
@JoaoGFarias

This comment has been minimized.

Copy link

JoaoGFarias commented Feb 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment