Trait nekolib::math::CarmichaelLambda
source · pub trait CarmichaelLambda {
// Required method
fn carmichael_lambda(self) -> Self;
}
Expand description
Carmichael の 関数。
は、 である任意の に対して となる最小の として定義される。
$\gdef{\lcm}{\operatorname*{lcm}}$ 以下の式によって計算される。
- for
- for odd prime
- $\lambda(\prod_{p:\text{ prime}} p_i^{e_i}) = \lcm_i \lambda(p_i^{e_i})$
Complexity
time.
Examples
use nekolib::math::CarmichaelLambda;
assert_eq!(1_u64.carmichael_lambda(), 1);
assert_eq!(15_u64.carmichael_lambda(), 4);
assert_eq!(21_u64.carmichael_lambda(), 6);
assert_eq!(33_u64.carmichael_lambda(), 10);