prime-data-0.1.0 has been yanked.
Visit the last successful build:
prime-data-0.1.2
Prime Data
This library was originally meant to be a simple way of working with prime numbers and storing prime numbers in a fast and memory-efficient way.
When you import this crate into your project, you will have, by default, access to the following tools:
Let's say you want to know what are all the prime numbers between 100 and 200:
let primes = generate
With that, you can do some cool things with it:
// You can iterate over all those prime numbers
for prime in primes.iter_all
// Therefore, you can collect them into a vector
println!;
// You don't have to iterate through all of them. Maybe you just want primes within some range
// Naturally, you can collect those into a vector too
for prime in primes.iter
// If you just want to know how many there are
println!;
// ...within a range
println!;
However, there are some handy public methods, that abstract you from the need of generating any data:
// You can verify if a number is prime
println!;
// You can count the amount of primes from 1 to some bound
println!;
Features
You'll get more functionality by including features in the dependency:
"factors"
The factors feature includes a struct and a public method for factorizing numbers.
#