Egyptian fraction by leonid

while 1:
 r=raw_input();x,y=map(int,r.split("/"));r+=" ="
 while x:d=0--y/x;r+=" 1/%d +"%d;x=-y%x;y*=d
 print r[:-2]

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

download

return to the top page