EratosthenesPrimeSieve constructor
EratosthenesPrimeSieve(
- int max
Constructs the prime sieve of Eratosthenes.
Implementation
EratosthenesPrimeSieve(super.max) : _isPrime = BitList.filled(max + 1, true) {
if (max >= 0) _isPrime[0] = false;
if (max >= 1) _isPrime[1] = false;
for (var i = 2; i * i <= max; i++) {
if (_isPrime[i]) {
for (var j = i * i; j <= max; j += i) {
_isPrime[j] = false;
}
}
}
}