I have a math website http://finitehelp.com that teaches students Finite Math. I thought it would be cool to include a calculator so I made one for combinations and permutat
I would prefer recursive function, tail recursive may cause stackoverflow for functions like fibonacci.
Math._factorial = function(n){
return Math._fact(n,1);
}
Math._fact= function(n,res){
n = Number(n);
if (n == null) {
alert("Factorial requires a numeric argument.");
return null;
} else if (n < 2){
return res;
} else {
return Math._fact(n-1, res*n);
}
}