void prime(unsigned long max){
if (max<2) return;
cout<<"2 3 ";
for (unsigned long i=5; i<=max; i+=2){
unsigned int ii=(unsigned int)sqrt(i);
for (unsigned long j=3; j<=ii; j+=2){
if (i%j==0) goto next;
}
cout<<i<<' ';
next:;
}
}
网上找到的6N+1,6N+5不靠谱,只能用来排除