1 unstable release
Uses old Rust 2015
0.2.0 | Oct 8, 2016 |
---|
#6 in #sqrt
10KB
129 lines
prime-suspects
An O(sqrt(n))-time implementation of Eratosthenes' sieve in Rust, with an additional implementation using segmented sieving to ensure O(sqrt(n)) memory usage.
I also wrote a Ruby version.
try it
cargo run --example simple_eratosthenes
cargo test
for different unit/documentation tests
docs
cargo doc --open
references
Shepmaster on Stack Overflow was beyond helpful in code review and in learning how to handle borrowing in parallel threads.
A list of other references I consulted along the way:
- http://research.cs.wisc.edu/techreports/1990/TR909.pdf
- https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithm_and_variants
- http://stackoverflow.com/questions/36221430/why-does-the-closure-for-take-while-take-its-argument-by-reference
- http://stackoverflow.com/questions/36988470/how-do-you-implement-an-iterator-whose-successor-depends-on-the-index-of-the-ter
Dependencies
~420KB