Skip to content

Instantly share code, notes, and snippets.

@wallstop
Created March 1, 2014 02:07
Show Gist options
  • Save wallstop/9283792 to your computer and use it in GitHub Desktop.
Save wallstop/9283792 to your computer and use it in GitHub Desktop.
import math
def fibonacci(index):
if(index < 1):
return -1
return int(1/math.sqrt(5) * math.pow(((1 + math.sqrt(5)) / 2), index) - 1/math.sqrt(5) * math.pow(((1 - math.sqrt(5)) / 2), index))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment