A wheel-based prime number sieve. Create a list of primes up to a given value. Fast up to at least 1E9.
A prime number generator written in Dart, using Euler's sieve and a wheel size of 210.
The performance of the prime determination is about half as fast as the C implementation. On my machine, it requires about 7.5 s (Dart) instead of 3.5 s (C) to find all primes up to 10^9.
(Printing however is way slower, instead of 3.5 s for the C version, the output takes about 80 s.)
dart example/prime_sieve.dart [options] <max>
Determine primality for all numbers up to
max should not exceed
memory, whatever is smaller.
--help: Print help
--[no-]count: Whether to output the count of primes found. (Default: true.)
--[no-]print: Whether to output the primes after calculating them. (Default: true.)
--query: Whether to enter a query input loop for primality tests after possibly printing the values.