pub trait CoprimeWith<RHS = Self> {
    fn coprime_with(self, other: RHS) -> bool;
}
Expand description

Determines whether two numbers are coprime.

Required Methods

Implementations on Foreign Types

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Returns whether two numbers are coprime; that is, whether they have no common factor other than 1.

Every number is coprime with 1. No number is coprime with 0, except 1.

$f(x, y) = (\gcd(x, y) = 1)$.

$f(x, y) = ((k,m,n \in \N \land x=km \land y=kn) \implies k=1)$.

Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

Examples

See here.

Implementors