prime-iter
A somewhat optimized incremental-sieve based prime generator.
Examples
The interface is given in the form of an iterator, so usage is very simple and idiomatic:
let fifty_second_prime = .nth.unwrap;
assert_eq!;
let prime_sum: i32 = .take.sum;
assert_eq!;
let two_digit_primes: = .skip_while.take_while.collect;
assert_eq!;
And of course for loops work too:
for prime in
no_std Support
prime-iter supports no-std environments, however it does use allocations. Disable the std feature,
which is enabled by default, for a no_std environment.
Installation
Either add this line to your Cargo.toml:
= "0.1"
Or simply run cargo add prime-iter.
License
Licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.