function a (n){return (1+1/n) ** n }
// a(9000000000)
// 2.718282053219686
function b (n){return (1+n) ** (1/n) }
// b(0.000000000001)
// 2.7185234960372378
//fact用來計算階層的倒數
function fact(x) {
if(x==0) {
return 1;
}
return 1 / x * fact(x-1) ;
}
function c(n) {
var total = fact(n);
for(i = 1; i <= n; i++ ){
total += fact(n - i)
}
return total;
}
//c(345)
>以上兩者給n到一數以上時都會為2.7.......
Math.newsqrt = function(a, b) {
if(b > 0) {
a = Math.sqrt(a);
return Math.newsqrt(a, b - 1);
} else {
return a
}
}
Math.newsqrt(Math.exp(1), Math.exp(1))