freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-417-reciprocal-cycl...

874 B
Raw Blame History

id title challengeType videoUrl
5900f50d1000cf542c51001f 问题417倒数周期II 5

--description--

单位分数在分子中包含1。给出分母2到10的单位分数的十进制表示

1/2 = 0.5 1/3 = 0.31/4 = 0.25 1/5 = 0.2 1/6 = 0.161/7 = 0.1428571/8 = 0.125 1/9 = 0.11/10 = 0.1

其中0.16表示0.166666 ...并具有1位循环周期。可以看出1/7具有6位循环周期。

分母没有其他素数因子而不是2和/或5的单位分数不被认为具有重复周期。我们将这些单位分数的重复周期的长度定义为0。

令Ln表示1 / n的循环周期的长度。给出ΣLn3≤n≤1000 000等于55535191115。

找ΣLn为3≤n≤100000 000

--hints--

euler417()应该返回446572970925740。

assert.strictEqual(euler417(), 446572970925740);

--solutions--