internalIsPrime method

bool internalIsPrime(
  1. int oddN
)

Returns whether oddN is prime, assuming it's an odd number. This is only public for testing. Use the public isPrime function instead.

Implementation

bool internalIsPrime(int oddN) {
  for (int i = 1;; ++i) {
    final p = i < _p.length ? _p[i] : addPrime();
    if (p * p > oddN) return true;
    if (oddN % p == 0) return false;
  }
}