Egyptian Fractions in Python, while loop isn't testing high enough unit fractions

后端 未结 0 1008
野的像风
野的像风 2021-02-01 09:15
from fractions import Fraction
n = 103
d = 104
nd = Fraction(n, d)
d1 = 1
while nd != 0:
    d1 = d1 + 1
    if Fraction(1, d1) <= nd:
        testfrac = Fraction(1,          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题