Number Theory: Arithmetic Functions
Many commands in this example worksheet are available at Maple's top level, meaning that no packages are required to be loaded. While any command in the Number Theory package can be referred to using the long form, for example, NumberTheory:-Totient, it is often easier to load the package and then use the short form command names as well.
Euler's totient function is an arithmetic function that counts the positive integers less than or equal to a given value, n, that are coprime to n. For a positive integer, n, another number k is said to be coprime, or relatively prime, if the greatest common divisor gcd⁡n,k = 1. For example, 14 and 15 are coprime because the gcd of 14 and 15 is 1, but 14 and 21 are not coprime since the gcd is 7.
Euler's totient function is also known as Euler's phi function, and is denoted as φ⁡n or ϕ⁡n. As such, φ⁡n and ϕ⁡n are aliases for the Totient command.
To visualize the first hundred values for phi(n):
The PrimeCounting (or pi) command returns the number of primes less than an integer, n.
To visualize the first hundred values for pi(n):
Comparing pi(n) with phi(n) for the first forty values for n:
The Moebius function is defined as a multiplicative arithmetic function mu(r), where:
r = 1 if r is a square-free positive integer with an even number of prime factors
r = -1 if r is a square-free positive integer with an odd number of prime factors
r = 0 if r has a squared prime factor
For example, mu(2) = −1 because 2 is a square-free positive integer which has one prime factor. mu(4) = 0 since 4 is not a square-free positive integer. The first 75 values for the Moebius function are plotted below:
Download Help Document