Skip to content

Instantly share code, notes, and snippets.

@wrboyce
Created September 9, 2011 15:28
Show Gist options
  • Select an option

  • Save wrboyce/1206520 to your computer and use it in GitHub Desktop.

Select an option

Save wrboyce/1206520 to your computer and use it in GitHub Desktop.
from math import sqrt
def fib(n):
x = (1+sqrt(5))/2
y = -(1/x)
return (x**n - y**n) / sqrt(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment