v0.5.0
This version focuses on adding support for generating primes and sieving numbers in arbitrary ranges, instead of always having to start from 0. It also shortens and clarifies some function names.
What's Changed
Breaking changes
- Rename
are_prime
tosieve
. - Rename
are_prime_below
tosieve_lt
. - Change function signature of
sieve_lt
. - Rename
largest_prime_leq
toprevious_prime
. - Rename
smallest_prime_lt
tonext_prime
. - Rename
prime_counts
tocount_primes
. - Remove
moebius
, as it is out of scope of this crate. If you want the source code for that function it can be found on Rosettacode, or in older versions of this crate.
New features
- Add
primes_geq
,primes_lt
, andsieve_geq
functions to work with arbitrary ranges. They take in two const generics, the number of values to return and the size of the sieve used during evaluation. - Add
primes_segment!
andsieve_segment!
macros to simplify usage of the above functions. These macros compute the size of the sieve that the above functions need. Due to restrictions on const arithmetic this can not be done inside the functions. - Add
isqrt
function. This can be useful if you wish to compute the size of the sieve yourself.
Minor changes
- Speed up
PRIMES::count_primes_leq
by using a binary instead of linear search. - Various documentation improvements.