Twin primes by 51b

-module(t).
-export([m/0]).
m()->f(4).
f(2002)->x;f(N)->case g(N,2)of 0->x;_->io:fwrite("~p,~p~n",[N-2,N])end,f(N+1).
g(N,X)->if X*X>N->1;0<1->N*(N-2)rem X*g(N,X+1)end.

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

download

return to the top page