addPrime method

int addPrime()

Adds the next prime and returns it.

Implementation

int addPrime() {
  while (true) {
    _n += 2;
    if (internalIsPrime(_n)) {
      _p.add(_n);
      return _n;
    }
  }
}