EratosthenesPrimeSieve class
Prime sieve of Eratosthenes.
The implementation has a time complexity of O(n * log(log(n))) and a space complexity of O(n).
- Inheritance
-
- Object
- PrimeSieve
- EratosthenesPrimeSieve
Constructors
- EratosthenesPrimeSieve(int max)
- Constructs the prime sieve of Eratosthenes.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- max → int
-
The maximum number this sieve supports.
finalinherited
-
primes
→ Iterable<
int> -
Returns an Iterable of all primes up to and including max.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isPrime(
int value) → bool -
Tests if a
value
is prime. Throws a RangeError exception ifvalue
is larger than max.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited