EulerPrimeSieve class

Prime sieve of Euler (linear sieve).

As a side-effect the algorithm can also provide the prime factors of all numbers up to and including max.

The implementation has a time and space complexity of O(n). However, the space complexity has a much larger constant factor than EratosthenesPrimeSieve.

See https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Euler's_sieve.

Inheritance

Constructors

EulerPrimeSieve(int max)
Constructs the prime sieve of Euler.

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

factorize(int value) → List<int>
Computes the prime factors of value.
isPrime(int value) → bool
Tests if a value is prime. Throws a RangeError exception if value 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