Created
November 18, 2014 10:10
-
-
Save MartinSvarrer/3794f8c54f59a2c88eaf 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) { | |
var sqrt5 = Math.sqrt(5) | |
return Math.round(1/sqrt5 *(Math.pow((1+sqrt5)/2, n) - Math.pow((1-sqrt5)/2, n))); | |
} | |
// output large fib number | |
console.log(fib2(1000)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment