-
-
Save nemmarramos/484053665134088fbe78b63ce5d57c02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 fib(n) { | |
const sqt = Math.sqrt(5); | |
const grd = (1 + sqt) / 2; | |
return Math.floor(Math.pow(grd, n) / sqt + 0.5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment