埃及分数分解
算法引自 https://blog.csdn.net/zrh_CSDN/article/details/81510631#commentBox ,不在赘述
def egypt(a,b):
"""a/b=1/(q+1)+(a-r)/b(q+1)"""
assert a<b
while b%a != 0:
q, r = b//a, b%a
a -= r
b *= (q+1)
yield q+1
yield int(b/a)
print(list(egypt(2,7)))