Created
February 19, 2019 05:27
-
-
Save joemaffei/f1f9c0b38b991452fca97488c081267d to your computer and use it in GitHub Desktop.
Calculate nth Fibonacci number
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
function fibonacci(n) { | |
return Math.round((Math.pow(1.618033988749895, n) - Math.pow(-0.618033988749895, n)) / 2.23606797749979); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment