This crate provides a beautifully simplistic API for generating the nth prime number.
primenumbe-rs algorithm is inspired by the the optimized version of the Sieve of Eratosthenes.
Note: limit of n index stands at [1, 1_000_000).
Disclaimer Not meant for Cryptographic & Security use.
Add this to your Cargo.toml
:
[dependencies]
primenumbe-rs = "0.1.2"
use primenumbe_rs::Primenumber;
fn main(){
let n: u64 = 100;
let result = Primenumber::nthprime(n);
println!("The {n}th prime is {result}");
}
Licensed under either of
-
Apache License, Version 2.0
-
MIT license
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.