pub trait Parity {
// Required methods
fn even(self) -> bool;
fn odd(self) -> bool;
}
Expand description
Determines whether a number is even or odd.
Determines whether a number is even.
Determines whether a number is odd.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is even.
$f(x) = (2|x)$.
$f(x) = (\exists k \in \N \ x = 2k)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Tests whether a number is odd.
$f(x) = (2\nmid x)$.
$f(x) = (\exists k \in \N \ x = 2k+1)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.