Egyptian fraction by Lost_dog

m@main=do s<-getLine;putStrLn$s++" = "++f(reads s);m
f[(x,_:y)]=drop 3$x#read y
0#_=""
x#y=" + 1/"++show(-q)++r#(-y*q)where(q,r)=divMod(-y)x

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

download

return to the top page