-------------------------------------------------- --------------------- ----------------------- front eye - ------------------------------------------------
#include <bits / STDC H ++.>
the using namespace STD;
const Long N = 10.00005 million;
Long Prime [N] = {0}; // record primes
long num_prime = 0; // represents the number of prime
int isNotPrime [N] = { 1, 1}; // record whether the prime number n
int main ()
{
for (I = 2 Long; I <N; I ++) {
(! isNotPrime [I]) {// iF I is a prime number, is recorded
Prime [num_prime ++] = I;
}
for (Long J = 0; J <num_prime Prime && * I [J] <N; J ++) {// * i a prime number is a composite number, recording
isNotPrime [i * prime [J]] =. 1;
IF filter to prevent duplication // ((I% Prime [J])!)
BREAK;
}
}
}