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

Determines whether a number is divisible by another number.

Required Methods

Implementations on Foreign Types

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \N : x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns whether a number is divisible by another number; in other words, whether the first number is a multiple of the second.

This means that zero is divisible by any number, including zero; but a nonzero number is never divisible by zero.

$f(x, m) = (m|x)$.

$f(x, m) = (\exists k \in \Z : \ x = km)$.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors