Crates.io | primality |
lib.rs | primality |
version | 0.1.0 |
source | src |
created_at | 2024-03-18 00:13:53.366147 |
updated_at | 2024-03-18 00:13:53.366147 |
description | Check if a number is prime |
homepage | https://github.com/izyuumi/primality |
repository | https://github.com/izyuumi/primality |
max_upload_size | |
id | 1176911 |
size | 8,220 |
Trait to check if a number is prime.
Add the following to your Cargo.toml
:
[dependencies]
primality = "0.1"
Or run the following command:
cargo add primality
use primality::IsPrime;
assert!(2i8.is_prime());
assert!(3usize.is_prime());
assert!(5u128.is_prime());
assert!(7i64.is_prime());
assert!(!4i16.is_prime());
assert!(!6u16.is_prime());
assert!(!8u32.is_prime());
assert!(!9i128.is_prime());
u8
u16
u32
u64
u128
usize
i8
i16
i32
i64
i128
isize
This project is licensed under the MIT license.