#pragma once
#include <cmath>
class PrimeNumberGenerator {
public:
explicit PrimeNumberGenerator(int start):
current((start > 1) ? start : 2) {}
int GetNextPrime() {
while (!this->isSimple()) {
this->current++;
}
return this->current++;
}
private:
int current;
bool isSimple() {
int num = std::sqrt(this->current);
for (int i = 2; i <= num; i++) {
if (this->current % i == 0)
return false;
}
return true;
}
};