Egyptian fraction by Hendrik

while 1:
 x,y=map(float,raw_input().split('/'));o="%d/%d = "%(x,y)
 while x:c=y/x-y/x%1+(y/x%1>0);x,y=-y%x,y*c;o+="1/%d"%c+" + "*(x>0)
 print o

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top