Collatz Problem by 51b

-module l.
-export[m/0].
m()->{_,[N]}=io:fread('',"~d"),c(N).
c(1)->io:write(1);c(N)->io:write(N),io:nl(),c(if N rem 2<1->N div 2;0<1->3*N+1end).

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

download

return to the top page