/primenumbe-rs

Generate the nth prime number

Primary LanguageRustMIT LicenseMIT

primenumbe-rs

Crates.io Crates.io

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.

Notice

Note: limit of n index stands at [1, 1_000_000).
Disclaimer Not meant for Cryptographic & Security use.

Usage

Add this to your Cargo.toml:

[dependencies]
primenumbe-rs = "0.1.2"

How To Use

use primenumbe_rs::Primenumber;

fn main(){
    let n: u64 = 100;
    let result = Primenumber::nthprime(n);
    println!("The {n}th prime is {result}");
}

License

Licensed under either of

  • Apache License, Version 2.0

  • MIT license

at your option.

Contribution

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.