def primes(n):
sieve = [True] * n
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i]:
sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
return [2] + [i for i in range(3, n, 2) if sieve[i]]
const int BE = 900000000;
const int N = 1000000000;
std::vector<int> small_primes;
bool DivisibleBySmallPrimes(int x) {
for (int i = 0; i < (int)small_primes.size() && small_primes[i]*small_primes[i] <= x; ++i) {
if (x % small_primes[i] == 0) return true;
}
return false;
}
void ComputeSmallPrimes() {
int n = sqrt(N);
for (int i = 2; i <= n; ++i) {
if (!DivisibleBySmallPrimes(i)) {
small_primes.push_back(i);
}
}
}
void ComputeSieve() {
ComputeSmallPrimes()
std::vector<bool> sieve(N-BE+1);
std::vector<int> primes;
for (auto &x : small_primes) {
int i = (BE-1) - (BE-1) % x + x;
while (i <= N) {
sieve[i-BE] = true;
i += x;
}
}
for (int i = BE; i <= N; ++i) {
if(!sieve[i-BE]) {
primes.push_back(i);
}
}
}