Factorize me by luqui

import Data.List\x0d
d m=(0==).mod m\x0d
c n=takeWhile(<=floor(sqrt(fromIntegral n)))p\x0d
p=2:filter(\n->not.any(d n).c$n)[3..]\x0d
f n=case filter(d n)(c n)of x:_->x:f(n`div`x);_->[n]\x0d
r[x]=x\x0d
r x=head x++"^"++show(length x)\x0d
l n=n++"="++(intercalate"*".map r.group.map show.f.read$n)\x0d
main=interact(unlines.map l.lines)\x0d

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

download

return to the top page