Integer Number Theory Functions

The IntegerNumberTheoryFunctions package contains a variety of operations of interest to number theorists. Many of these operations deal with divisibility properties of integers (Recall that an integer a divides an integer b if there is an integer c such that b=a*c.) The operation divisors returns a list of the divisors of an integer

You can now compute the number of divisors of 144 and the sum of the divisors of 144 by counting and summing the elements of the list we just created.

Of course, you can compute the number of divisors of an integer n, usually denoted d(n), and the sum of the divisors of an integer n, usually denoted ς(n), without ever listing the divisors of n. In Axiom, you can simply call the operations

The key is that d(n) and ς(n) are "multiplicative functions". This means that when n and m are relatively prime, that is, when n and m have no factors in common, then d(nm)=d(n)d(m) and ς(nm)= ς(n)ς(m). Note that these functions are trivial to compute when n is a prime power and are computed for general n from the prime factorization of n. Other examples of multiplicative functions are ς_k(n), the sum of the k-th powers of the divisors of n and φ(n), the number of integers between 1 and n which are prime to n. The corresponding Axiom operations are called sumOfKthPowerDivisors and eulerPhi.

An interesting function is called μ(n), the Moebius mu function, defined as

            0 if n has a repeated prime factor
              (i.e. is divisible by a square)
      μ(n)= 1 if n is 1
           (-1)^k if n is the product of k distinct primes

The corresponding Axiom operation is

This function occurs in the following theorem:
Theorem(Moebius Inversion Formula):
Let f(n) be a function on the positive integers and let F(n) be defined by F(n)=sum of f(n) over d | n where the sum is taken over the positive divisors of n. Then the values of f(n) can be recovered from the values of F(n):f(n) = sum of μF(n/d) over d|n, where the sum is taken over the positive divisors of n. When f(n)=1, the F(n)=d(n). Thus, if you sum μ(d)*d(n/d) over the positive divisors of d of n, you should always get 1.

Similarly, when f(n)=n, then F(n)=ς(n). Thus, if you sum μ(d)*ς(n/d) over the positive divisors d of n, you should always get n.

The Fibonacci numbers are defined by

      F(1)=1
      F(2)=1
      F(n)=F(n-1)+F(n-2) for n=3,4,...

The operation fibonacci computes the nth Fibonacci number.

Fibonacci numbers can also be expressed as sums of binomial coefficients.

Quadratic symbols can be computed with the operations legendre and jacobi. The Legendre symbol (a/p) is defined for integers a and p with p an odd prime number. By definition,

            = -1 when a is not a square (mod p)
      (a/p) =  0 when a is divisible by p
            = +1 when a is a square (mod p)

You compute (a/p) via the command legendre(a,p)

The Jacobi symbol (a/n) is the usual extension of the Legendre symbol, where n is an arbitrary integer. The most important property of the Jacobi symbol is the following: if K is a quadratic field with discriminant d and quadratic character χ, the χ(n)=(d/n). Thus, you can use the Jacobi symbol to compute, say, the class numbers of imaginary quadratic fields from a standard class number formula. This function computes the class number of the imaginary quadratic field with discriminant d.