pub fn mobius(n: u64) -> i32Expand description
Mobius function mu(n):
- 1 if n is squarefree with an even number of prime factors
- -1 if n is squarefree with an odd number of prime factors
- 0 if n has a repeated prime factor
ยงExamples
use mathverse_core::integer::mobius;
assert_eq!(mobius(1), 1);
assert_eq!(mobius(2), -1);
assert_eq!(mobius(4), 0);