# Arithmetic function

In number theory, an **arithmetic**, **arithmetical**, or **number-theoretic function**^{[1]}^{[2]} is for most authors^{[3]}^{[4]}^{[5]} any function *f*(*n*) whose domain is the positive integers and whose range is a subset of the complex numbers. Hardy & Wright include in their definition the requirement that an arithmetical function "expresses some arithmetical property of *n*".^{[6]}

An example of an arithmetic function is the divisor function whose value at a positive integer *n* is equal to the number of divisors of *n*.

There is a larger class of number-theoretic functions that do not fit the above definition, for example, the prime-counting functions. This article provides links to functions of both classes.

Arithmetic functions are often extremely irregular (see table), but some of them have series expansions in terms of Ramanujan's sum.

Two whole numbers *m* and *n* are called coprime if their greatest common divisor is 1, that is, if there is no prime number that divides both of them.

It is often convenient to write this as an infinite product over all the primes, where all but a finite number have a zero exponent. Define the *p*-adic valuation **ν _{p}(n)** to be the exponent of the highest power of the prime

*p*that divides

*n*. That is, if

*p*is one of the

*p*

_{i}then

*ν*

_{p}(

*n*) =

*a*

_{i}, otherwise it is zero. Then

In terms of the above the prime omega functions ω and Ω are defined by

To avoid repetition, whenever possible formulas for the functions listed in this article are given in terms of *n* and the corresponding *p*_{i}, *a*_{i}, ω, and Ω.

**σ _{k}(n)** is the sum of the

*k*th powers of the positive divisors of

*n*, including 1 and

*n*, where

*k*is a complex number.

**σ _{1}(n)**, the sum of the (positive) divisors of

*n*, is usually denoted by

**σ(**.

*n*)Since a positive number to the zero power is one, **σ _{0}(n)** is therefore the number of (positive) divisors of

*n*; it is usually denoted by

**or**

*d*(*n*)**τ(**(for the German

*n*)*Teiler*= divisors).

**φ( n)**, the Euler totient function, is the number of positive integers not greater than

*n*that are coprime to

*n*.

**J _{k}(n)**, the Jordan totient function, is the number of

*k*-tuples of positive integers all less than or equal to

*n*that form a coprime (

*k*+ 1)-tuple together with

*n*. It is a generalization of Euler's totient, φ(

*n*) = J

_{1}(

*n*).

**μ( n)**, the Möbius function, is important because of the Möbius inversion formula. See Dirichlet convolution, below.

**τ( n)**, the Ramanujan tau function, is defined by its generating function identity:

Although it is hard to say exactly what "arithmetical property of *n*" it "expresses",^{[7]} (*τ*(*n*) is (2π)^{−12} times the *n*th Fourier coefficient in the q-expansion of the modular discriminant function)^{[8]} it is included among the arithmetical functions because it is multiplicative and it occurs in identities involving certain σ_{k}(*n*) and *r*_{k}(*n*) functions (because these are also coefficients in the expansion of modular forms).

** c_{q}(n)**, Ramanujan's sum, is the sum of the

*n*th powers of the primitive

*q*th roots of unity:

Even though it is defined as a sum of complex numbers (irrational for most values of *q*), it is an integer. For a fixed value of *n* it is multiplicative in *q*:

The Dedekind psi function, used in the theory of modular functions, is defined by the formula

All **Dirichlet characters χ(n)** are completely multiplicative. Two characters have special notations:

The **principal character (mod n)** is denoted by

*χ*

_{0}(

*a*) (or

*χ*

_{1}(

*a*)). It is defined as

The **quadratic character (mod n)** is denoted by the Jacobi symbol for odd

*n*(it is not defined for even

*n*):

**ω( n)**, defined above as the number of distinct primes dividing

*n*, is additive (see Prime omega function).

**Ω( n)**, defined above as the number of prime factors of

*n*counted with multiplicities, is completely additive (see Prime omega function).

For a fixed prime *p*, ** ν_{p}(n)**, defined above as the exponent of the largest power of

*p*dividing

*n*, is completely additive.

These important functions (which are not arithmetic functions) are defined for non-negative real arguments, and are used in the various statements and proofs of the prime number theorem. They are summation functions (see the main section just below) of arithmetic functions which are neither multiplicative nor additive.

**π( x)**, the prime-counting function, is the number of primes not exceeding

*x*. It is the summation function of the characteristic function of the prime numbers.

A related function counts prime powers with weight 1 for primes, 1/2 for their squares, 1/3 for cubes, ... It is the summation function of the arithmetic function which takes the value 1/*k* on integers which are the k-th power of some prime number, and the value 0 on other integers.

** θ(x)** and

**, the Chebyshev functions, are defined as sums of the natural logarithms of the primes not exceeding**

*ψ*(*x*)*x*.

The Chebyshev function *ψ*(*x*) is the summation function of the von Mangoldt function just below.

**Λ( n)**, the von Mangoldt function, is 0 unless the argument

*n*is a prime power

*p*

^{k}, in which case it is the natural log of the prime

*p*:

** p(n)**, the partition function, is the number of ways of representing

*n*as a sum of positive integers, where two representations with the same summands in a different order are not counted as being different:

For powers of odd primes and for 2 and 4, *λ*(*n*) is equal to the Euler totient function of *n*; for powers of 2 greater than 4 it is equal to one half of the Euler totient function of *n*:

** h(n)**, the class number function, is the order of the ideal class group of an algebraic extension of the rationals with discriminant

*n*. The notation is ambiguous, as there are in general many extensions with the same discriminant. See quadratic field and cyclotomic field for classical examples.

** r_{k}(n)** is the number of ways

*n*can be represented as the sum of

*k*squares, where representations that differ only in the order of the summands or in the signs of the square roots are counted as different.

Using the Heaviside notation for the derivative, ** D(n)** is a function such that

Given an arithmetic function *a*(*n*), its **summation function** *A*(*x*) is defined by

Since such functions are often represented by series and integrals, to achieve pointwise convergence it is usual to define the value at the discontinuities as the average of the values to the left and right:

Individual values of arithmetic functions may fluctuate wildly – as in most of the above examples. Summation functions "smooth out" these fluctuations. In some cases it may be possible to find asymptotic behaviour for the summation function for large *x*.

A classical example of this phenomenon^{[9]} is given by the divisor summatory function, the summation function of *d*(*n*), the number of divisors of *n*:

An **average order of an arithmetic function** is some simpler or better-understood function which has the same summation function asymptotically, and hence takes the same values "on average". We say that *g* is an *average order* of *f* if

as *x* tends to infinity. The example above shows that *d*(*n*) has the average order log(*n*).^{[10]}

Given an arithmetic function *a*(*n*), let *F*_{a}(*s*), for complex *s*, be the function defined by the corresponding Dirichlet series (where it converges):^{[11]}

The generating function of the Möbius function is the inverse of the zeta function:

Consider two arithmetic functions *a* and *b* and their respective generating functions *F*_{a}(*s*) and *F*_{b}(*s*). The product *F*_{a}(*s*)*F*_{b}(*s*) can be computed as follows:

A particularly important case is convolution with the constant function *a*(*n*) = 1 for all *n*, corresponding to multiplying the generating function by the zeta function:

Multiplying by the inverse of the zeta function gives the Möbius inversion formula:

If *f* is multiplicative, then so is *g*. If *f* is completely multiplicative, then *g* is multiplicative, but may or may not be completely multiplicative.

There are a great many formulas connecting arithmetical functions with each other and with the functions of analysis, especially powers, roots, and the exponential and log functions. The page divisor sum identities contains many more generalized and related examples of identities involving arithmetic functions.

That is, if *n* is odd, *σ*_{k}^{*}(*n*) is the sum of the *k*th powers of the divisors of *n*, that is, *σ*_{k}(*n*), and if *n* is even it is the sum of the *k*th powers of the even divisors of *n* minus the sum of the *k*th powers of the odd divisors of *n*.

Adopt the convention that Ramanujan's *τ*(*x*) = 0 if *x* is **not an integer.**

Here "convolution" does not mean "Dirichlet convolution" but instead refers to the formula for the coefficients of the product of two power series:

Since *σ*_{k}(*n*) (for natural number *k*) and *τ*(*n*) are integers, the above formulas can be used to prove congruences^{[35]} for the functions. See Ramanujan tau function for some examples.

Peter Gustav Lejeune Dirichlet discovered formulas that relate the class number *h* of quadratic number fields to the Jacobi symbol.^{[37]}

An integer *D* is called a **fundamental discriminant** if it is the discriminant of a quadratic number field. This is equivalent to *D* ≠ 1 and either a) *D* is squarefree and *D* ≡ 1 (mod 4) or b) *D* ≡ 0 (mod 4), *D*/4 is squarefree, and *D*/4 ≡ 2 or 3 (mod 4).^{[38]}

Extend the Jacobi symbol to accept even numbers in the "denominator" by defining the Kronecker symbol:

There is also a formula relating *r*_{3} and *h*. Again, let *D* be a fundamental discriminant, *D* < −4. Then^{[41]}

The Riemann hypothesis is also equivalent to the statement that, for all *n* > 5040,

Let *m* and *n* be distinct, odd, and positive. Then the Jacobi symbol satisfies the law of quadratic reciprocity:

Let *D*(*n*) be the arithmetic derivative. Then the logarithmic derivative

See Multiplicative group of integers modulo n and Primitive root modulo n.