Last active
April 13, 2018 12:42
-
-
Save DorukUlucay/0e873d078228c66e8d3dbf7abfb3495d to your computer and use it in GitHub Desktop.
math
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 factorial(n) { | |
if (n < 2) { | |
return 1; | |
} | |
return n * factorial(n - 1); | |
} |
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
/* | |
first : first number of sequence | |
second : second number of sequence | |
max : the number sequence must stop before | |
*/ | |
function fib(first, second, max) { | |
if (second < max) { | |
console.log(first); | |
console.log(second); | |
fib(first + second, second + second + first, max); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment