Trait malachite_base::num::arithmetic::traits::RootAssignRem
source · pub trait RootAssignRem<POW> {
type RemOutput;
// Required method
fn root_assign_rem(&mut self, exp: POW) -> Self::RemOutput;
}
Expand description
Replaces a number with the floor of its $n$th root, returning the remainder.
Required Associated Types§
Required Methods§
fn root_assign_rem(&mut self, exp: POW) -> Self::RemOutput
Implementations on Foreign Types§
source§impl RootAssignRem<u64> for u8
impl RootAssignRem<u64> for u8
source§fn root_assign_rem(&mut self, exp: u64) -> u8
fn root_assign_rem(&mut self, exp: u64) -> u8
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
type RemOutput = u8
source§impl RootAssignRem<u64> for u16
impl RootAssignRem<u64> for u16
source§fn root_assign_rem(&mut self, exp: u64) -> u16
fn root_assign_rem(&mut self, exp: u64) -> u16
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
type RemOutput = u16
source§impl RootAssignRem<u64> for u32
impl RootAssignRem<u64> for u32
source§fn root_assign_rem(&mut self, exp: u64) -> u32
fn root_assign_rem(&mut self, exp: u64) -> u32
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
type RemOutput = u32
source§impl RootAssignRem<u64> for u64
impl RootAssignRem<u64> for u64
source§fn root_assign_rem(&mut self, exp: u64) -> u64
fn root_assign_rem(&mut self, exp: u64) -> u64
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
type RemOutput = u64
source§impl RootAssignRem<u64> for u128
impl RootAssignRem<u64> for u128
source§fn root_assign_rem(&mut self, exp: u64) -> u128
fn root_assign_rem(&mut self, exp: u64) -> u128
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.
type RemOutput = u128
source§impl RootAssignRem<u64> for usize
impl RootAssignRem<u64> for usize
source§fn root_assign_rem(&mut self, exp: u64) -> usize
fn root_assign_rem(&mut self, exp: u64) -> usize
Replaces an integer with the floor of its $n$th root, and returns the remainder (the difference between the original integer and the $n$th power of the floor).
$f(x, n) = x - \lfloor\sqrt[n]{x}\rfloor^n$,
$x \gets \lfloor\sqrt[n]{x}\rfloor$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if exp
is zero.
§Examples
See here.