Created
March 1, 2014 02:07
-
-
Save wallstop/9283792 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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