Find the nearest Prime by nn

System.in.eachLine{p=it as int
for(i=0;[2g,13g].any{it.modPow(p-1,p)>1}?p+=i++*(i%2*2-1):println(p););}

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

download

return to the top page