Skip to main content

are_coprime

Function are_coprime 

Source
pub const fn are_coprime(left: i128, right: i128) -> bool
Expand description

Returns whether two integers share no positive common divisor other than one.

Examples found in repository?
examples/basic_usage.rs (line 6)
3fn main() -> Result<(), use_integer::IntegerError> {
4    assert_eq!(classify_sign(-42), IntegerSign::Negative);
5    assert!(is_divisible_by(42, 6)?);
6    assert!(are_coprime(35, 64));
7    assert_eq!(gcd(-54, 24), 6);
8    assert_eq!(lcm(-6, 15)?, 30);
9
10    Ok(())
11}