1000/1+1000/2+1000/3+...1000/n=10000
// 请用JavaScript的递归方式,写出求n的代码
1000/1+1000/2+1000/3+...1000/n=10000
// 请用JavaScript的递归方式,写出求n的代码
var total=0;
function test(num=1){
total += 1000 / num;
if(total >= 10000) {
console.log(num);
return;
}
test(++num)
}
test()