Nth prime by hallvabo

i,k,n,a[1<<18];main(j){for(i=1;j<1e4;)if(!a[++i]){for(k=i;k<2e5;k+=i)a[k]=1;a[j++]=i;}for(;~scanf("%d",&n);)printf("%d\n",a[n]);}

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

download

return to the top page