happy number by 51b

-module(h).
-export([m/0]).
m()->[f(N,N)||N<-lists:seq(1,2000)].
f(1,N)->io:write(N),io:nl();f(4,_)->0;f(M,N)->f(g(M),N).
g(0)->0;g(N)->M=N rem$
,M*M+g(N div$
).

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

download

return to the top page