Skip to content

Instantly share code, notes, and snippets.

@DorukUlucay
Last active April 13, 2018 12:42
Show Gist options
  • Save DorukUlucay/0e873d078228c66e8d3dbf7abfb3495d to your computer and use it in GitHub Desktop.
Save DorukUlucay/0e873d078228c66e8d3dbf7abfb3495d to your computer and use it in GitHub Desktop.
math
function factorial(n) {
if (n < 2) {
return 1;
}
return n * factorial(n - 1);
}
/*
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