展开全部
Well, ’cause I noticed that some of the number can’t be divided exactly,
so I thought keeping the result as a fraction would be more accurate.
But after done writing, I found it’s not that valuable to use fraction,
the number would get huge because there’s not manycommon factors between the nominator and denominator.
My code is here, just for reference~62616964757a686964616fe78988e69d8331333332636366
#2/1 + 3/2 + 5/3 + 8/5 + … …
#Some number can’t be divided exactly. Use fraction to keep the result.
#
#get all factors of a number
def getFactors(num):
facList = []
while num % 2 == 0:
facList.append(2)
num /= 2
limit = int(num**(0.5)+1)
for i in range(3,limit+2, 2):
if num % i == 0:
facList.append(i)
num