Some Number Theoretic Functions

Axiom provides several number theoretic operations for integers. More examples are in IntegerNumberTheoryFunctions, The operation fibonacci computes the Fibonacci numbers. The algorithm has a running time O(log(n)**3) for argument n.

The operation legendre computes the Legendre symbol for its two integer arguments where the second one is prime. If you know the second argument to be prime, use jacobi instead where no check is made.

The operation jacobi computes the Jacobi symbol for its two integer arguments. By convention, 0 is returned if the greatest common divisor of the numerator and denominator is not 1.

The operation eulerPhi compute the values of Euler's φ-function where φ(n) equals the number of positive integers less than or equal to n that are relatively prime to the positive integer n.

The operation moebiusMu computes the Moebius μ function.

Although they have somewhat limited utility, Axiom provides Roman numerals.