z_archive/problem27/main.cpp
// This is the Sieve of Eratostenes
This is the Sieve of Eratostenes
This is the Sieve of Eratostenes
void prime_sieve(int n)
{
	primes.insert(1);
	for (int i = 2; i < n; i++)
	{
		if (not_primes.find(i) != not_primes.end())
		{
			continue;
		}
		else
		{
			primes.insert(i);
		}
		for (int j = i * 2; j < n; j+=i)
		{
			not_primes.insert(j);
		}
	}
}
void prime_sieve ( int n ) { primes . insert ( 1 ) ; for ( int i = 2 ; i < n ; i ++ ) { if ( not_primes . find ( i ) != not_primes . end ( ) ) { continue ; } else { primes . insert ( i ) ; } for ( int j = i * 2 ; j < n ; j += i ) { not_primes . insert ( j ) ; } } }
This is the Sieve of Eratostenes
This is the Sieve of Eratostenes
//cout << "Prime: " << i << endl; //cout << "Not a prime: " << j << endl;