Egyptian fraction by @tttttanaka

#!ruby -nalF/
$><<$_+" = 1/"
a,b=$F.map &:to_i
loop{b%a<1?(p b/a;break):($><<"#{c=b/a+1} + 1/";a=a*c-b;b*=c)}

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

download

return to the top page