#include <iostream>
#include <algorithm>
#include <sstream>

class PrimeNumberGenerator {
 public:
  explicit PrimeNumberGenerator(int start) {
    this->last = start;
  }

  int GetNextPrime() {
    int i = this->last - 1;

    while (true) {
      if (this->last % i == 0) {
        this->last++;
        i = this->last - 1;

      } else if (i == 2) {
        return this->last++;

      } else {
        i--;
      }
    }
  }

  int last;
};