Egyptian fraction by henkma(thx to rst76)

a#b=do n<-[-div(-b)a|a>0];" + 1/"++show n++(a*n-b)#(n*b)
m@main=do
l<-getLine
putStrLn$l++" ="++2`drop`do(a,_:b)<-reads l;a#read b
m

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

download

return to the top page