PrimeUtils class
Utils for prime numbers.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Properties
-
knownPrimes
→ UnmodifiableListView<
int> -
A list of known primes.
Used to compute if a number is prime or not.
no setter
-
knownPrimesIterator
→ Iterator<
int> -
no setter
- knownPrimesLength → int
-
no setter
- lastKnownPrime → int
-
Returns the last known prime in the knownPrimes list.
no setter
Static Methods
-
contractKnownPrimes(
int knownPrimesLength) → void -
Contracts the knownPrimes list length to
knownPrimesLength
. -
expandKnownPrimes(
int knownPrimesLength) → void -
Expands the knownPrimes list to length
knownPrimesLength
. -
generatePrimes(
int length, {int? primeLimit}) → List< int> -
Generates a List of prime numbers of
length
and belowprimeLimit
(if provided). -
isKnownPrime(
int n) → bool? -
Returns
true
ifn
is in the knownPrimes list.