When will the decimals in a/b repeat?

🫧 Open on Bubbles The previous post looked at how many digits are in the reduced fraction for the n th harmonic number. I was curious about how long the cycle of digits in a harmonic number might be. I wrote about the period length for the digits of fractions almost a decade ago . This post includes code so I can apply it to harmonic demoninators. from sympy import lcm, factorint, n_order def period(n): factors = factorint(n) exp2 = factors.get(2, 0) exp5 = factors.get(5, 0) r = max(exp2, exp5) d = n // (2*

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论