This library adds several functions useful for doing math on integers. Most of these are GMP wrappers that may have faster implimentations for smaller integer types.
Functions
iroot(x::Integer, n::integer)
the integer nth root ofx
. Specifically, this is the largest integera
such thata^n <= x
. Note thatn
must fit into anInt64
(for GMP compatability).ispower(x::Integer)
return if there are integerbase
andexponent>1
values such thatbase^exponent = x
.find_exponent(x::Integer)
returns the largest possible integerexponent
such thatbase^exponent = x
for somebase
. Returns1
forx ∈ [0,1]
.is_probably_prime(x::Integer; reps=25)
returns ifx
is prime. Will be incorrect less than4^-reps
of the time.kronecker(a::Integer, n::Integer)
Computes the Kronecker_symbol which is a generalization of the legendre and jacobi symbols.