Module malachite_base::num::arithmetic::kronecker_symbol
source · Expand description
LegendreSymbol
, JacobiSymbol
, and
KroneckerSymbol
, traits for computing the Legendre, Jacobi, and
Kronecker symbols of two numbers.
§legendre_symbol
use malachite_base::num::arithmetic::traits::LegendreSymbol;
assert_eq!(10u8.legendre_symbol(5), 0);
assert_eq!(7u8.legendre_symbol(5), -1);
assert_eq!(11u8.legendre_symbol(5), 1);
assert_eq!((-7i8).legendre_symbol(5), -1);
assert_eq!((-11i8).legendre_symbol(5), 1);
§jacobi_symbol
use malachite_base::num::arithmetic::traits::JacobiSymbol;
assert_eq!(10u8.jacobi_symbol(5), 0);
assert_eq!(7u8.jacobi_symbol(5), -1);
assert_eq!(11u8.jacobi_symbol(5), 1);
assert_eq!(11u8.jacobi_symbol(9), 1);
assert_eq!((-7i8).jacobi_symbol(5), -1);
assert_eq!((-11i8).jacobi_symbol(5), 1);
assert_eq!((-11i8).jacobi_symbol(9), 1);
§kronecker_symbol
use malachite_base::num::arithmetic::traits::KroneckerSymbol;
assert_eq!(10u8.kronecker_symbol(5), 0);
assert_eq!(7u8.kronecker_symbol(5), -1);
assert_eq!(11u8.kronecker_symbol(5), 1);
assert_eq!(11u8.kronecker_symbol(9), 1);
assert_eq!(11u8.kronecker_symbol(8), -1);
assert_eq!((-7i8).kronecker_symbol(5), -1);
assert_eq!((-11i8).kronecker_symbol(5), 1);
assert_eq!((-11i8).kronecker_symbol(9), 1);
assert_eq!((-11i8).kronecker_symbol(8), -1);
assert_eq!((-11i8).kronecker_symbol(-8), 1);