Collatz Problem by pi8027

main=readLn>>=mapM print.f
f n|n==1=[n]|odd n=n:f(n*3+1)|True=n:f(div n 2)

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

download

return to the top page