共计 260 个字符,预计需要花费 1 分钟才能阅读完成。
转化 分母
(1)1/1 1/1 (1)
(2)1-1/2 1/2 (2)
(3)1-1/2+1/3 1/2+1/3 (2,3)
(4)1-1/2+1/3-1/4 1/3+1/4 (3,4)
(5) 1/3+1/4+1/5 (3,4,5)
(6) 1/4+1/5+1/6 (4,5,6)
(7) 1/4+1/5+1/6+1/7 (4,5,6,7)
(8) 1/5+1/6+1/7+1/8 (5,6,7,8)
function f(n){
let res = 0;
for (let i = n; i >= Math.floor(n / 2) + 1; i--) {res += (1 / i);
}
return res;
}
正文完
发表至: javascript
2022-11-24