头图
                     转化               分母
(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;
}

perkz
51 声望27 粉丝

new Markdown()