C++代码
int main()
{
const int max =100;
long primes[max] = {2,3,5 };
long trial = 5;
int count =3;
int found =0;
do
{
trial +=2;
for(int i=0;i< count;i++)
{
found = (trial % *(primes + i)) == 0;
if(found)
break;
}
if(found == 0)
*(primes + count++) = trial;
}while(count < max);
return 0;
}