Twin primes by konn(ERAT)

main=mapM_(putStrLn.tail.init.show)[(p,q)|p<-t,q<-t,p+2==q]
t=s[3,5..2000]
s(p:r)=p:s[q|q<-r,q`mod`p>0]
s k=k

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

download

return to the top page