pub trait IsPower {
// Required method
fn is_power(&self) -> bool;
}Expand description
A trait for testing whether a number is a perfect power.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IsPower for i8
impl IsPower for i8
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for i16
impl IsPower for i16
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for i32
impl IsPower for i32
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for i64
impl IsPower for i64
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for i128
impl IsPower for i128
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for isize
impl IsPower for isize
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for u8
impl IsPower for u8
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for u16
impl IsPower for u16
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for u32
impl IsPower for u32
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for u64
impl IsPower for u64
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for u128
impl IsPower for u128
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl IsPower for usize
impl IsPower for usize
Source§fn is_power(&self) -> bool
fn is_power(&self) -> bool
Determines whether an integer is a perfect power. We define a perfect power as any number of the form $a^x$ where $x > 1$, with $a$ and $x$ both integers. In particular 0 and 1 are considered perfect powers.
$f(x) = (\exists b \in \Z, e \in \N : e > 1 \ \text{and} \ b^e = x)$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.