# Average order of an arithmetic function

In number theory, an average order of an arithmetic function is some simpler or better-understood function which takes the same values "on average".

Let ${\displaystyle f}$ be an arithmetic function. We say that an average order of ${\displaystyle f}$ is ${\displaystyle g}$ if

${\displaystyle \sum _{n\leq x}f(n)\sim \sum _{n\leq x}g(n)}$

as ${\displaystyle x}$ tends to infinity.

It is conventional to choose an approximating function ${\displaystyle g}$ that is continuous and monotone. But even so an average order is of course not unique.

In cases where the limit

${\displaystyle \lim _{N\rightarrow \infty }{\frac {1}{N}}\sum _{n\leq N}f(n)=c}$

exists, it is said that ${\displaystyle f}$ has a mean value (average value) ${\displaystyle c}$.

## Examples

• An average order of d (n), the number of divisors of n, is log n;
• An average order of σ (n), the sum of divisors of n, is n π2/ 6;
• An average order of φ (n), Euler's totient function of n, is 6 n/ π2;
• An average order of r (n), the number of ways of expressing n as a sum of two squares, is π n;
• The average order of representations of a natural number as a sum of three squares is 4π n/ 3;
• The average number of decompositions of a natural number into a sum of one or more consecutive prime numbers is n log 2;
• An average order of ω (n), the number of distinct prime factors of n, is log log n;
• An average order of Ω (n), the number of prime factors of n, is log log n;
• The prime number theorem is equivalent to the statement that the von Mangoldt function Λ (n) has average order 1;
• An average order of μ (n), the Möbius function, is zero; this is again equivalent to the prime number theorem.

## Calculating mean values using Dirichlet series

In case ${\displaystyle F}$ is of the form

${\displaystyle F(n)=\sum _{d\mid n}f(d),}$

for some arithmetic function ${\displaystyle f(n)}$, one has,

${\displaystyle \sum _{n\leq x}F(n)=\sum _{d\leq x}f(d)\sum _{n\leq x,d\mid n}1=\sum _{d\leq x}f(d)[x/d]=x\sum _{d\leq x}{\frac {f(d)}{d}}{\text{ }}+O(\sum _{d\leq x}|f(d)|).\qquad \qquad (1)}$

This identity often provides a practical way to calculate the mean value in terms of the Riemann zeta function. This is illustrated in the following example.

### The density of the k-th power free integers in N

For an integer ${\displaystyle k\geq 1}$ the set ${\displaystyle Q_{k}}$ of k-th-power-free integers is

${\displaystyle Q_{k}:=\{n\in \mathbb {Z} \mid n{\text{ is not divisible by }}d^{k}{\text{ for any integer }}d\geq 2\}.}$

We calculate the natural density of these numbers in N, that is, the average value of ${\displaystyle 1_{Q_{k}}}$, denoted by ${\displaystyle \delta (n)}$, in terms of the zeta function.

The function ${\displaystyle \delta }$ is multiplicative, and since it is bounded by 1, its Dirichlet series converges absolutely in the half-plane ${\displaystyle \mathrm {Re} (s)<1}$, and there has Euler product

${\displaystyle \sum _{Q_{k}}n^{-s}=\sum _{n}\delta (n)n^{-s}=\prod _{p}(1+p^{-s}+\cdots +p^{-s(k-1)})=\prod _{p}\left({\frac {1-p^{-sk}}{1-p^{-s}}}\right)={\frac {\zeta (s)}{\zeta (sk)}}.}$

By the Möbius inversion formula, we get

${\displaystyle {\frac {1}{\zeta (ks)}}=\sum _{n}\mu (n)n^{-ks},}$

where ${\displaystyle \mu }$ stands for the Möbius function. Equivalently,

${\displaystyle {\frac {1}{\zeta (ks)}}=\sum _{n}f(n)n^{-s},}$

where ${\displaystyle f(n)={\begin{cases}\;\;\,\mu (d)&n=d^{k}\\\;\;\,0&{\text{otherwise}},\end{cases}}}$

and hence,

${\displaystyle {\frac {\zeta (s)}{\zeta (sk)}}=\sum _{n}(\sum _{d\mid n}f(d))n^{-s}.}$

By comparing the coefficients, we get

${\displaystyle \delta (n)=\sum _{d\mid n}f(d)n^{-s}.}$

Using (1), we get

${\displaystyle \sum _{d\leq x}\delta (d)=x\sum _{d\leq x}(f(d)/d)+O(x^{1/k}).}$

We conclude that,

${\displaystyle \sum _{n\in Q_{k},n\leq x}1={\frac {x}{\zeta (k)}}+O(x^{1/k}),}$

where for this we used the relation

${\displaystyle \sum _{n}(f(n)/n)=\sum _{n}f(n^{k})n^{-k}=\sum _{n}\mu (n)n^{-k}={\frac {1}{\zeta (k)}},}$

which follows from the Möbius inversion formula.

In particular, the density of the square-free integers is ${\displaystyle \zeta (2)^{-1}={\frac {6}{\pi ^{2}}}}$.

### Visibility of lattice points

We say that two lattice points are visible from one another if there is no lattice point on the open line segment joining them.

Now, if gcd(a, b) = d > 1, then writing a = da2, b = db2 one observes that the point (a2, b2) is on the line segment which joins (0,0) to (a, b) and hence (a, b) is not visible from the origin. Thus (a, b) is visible from the origin implies that (a, b) = 1. Conversely, it is also easy to see that gcd(a, b) = 1 implies that there is no other integer lattice point in the segment joining (0,0) to (a,b). Thus, (a, b) is visible from (0,0) if and only if gcd(a, b) = 1.

Notice that ${\displaystyle {\frac {\varphi (n)}{n}}}$ is the probability of a random point on the square ${\displaystyle \{(r,s)\in \mathbb {N} :\max(|r|,|s|)=n\}}$ to be visible from the origin.

Thus, one can show that the natural density of the points which are visible from the origin is given by the average,

${\displaystyle \lim _{N\rightarrow \infty }{\frac {1}{N}}\sum _{n\leq N}{\frac {\varphi (n)}{n}}={\frac {6}{\pi ^{2}}}={\frac {1}{\zeta (2)}}.}$

interestingly, ${\displaystyle {\frac {1}{\zeta (2)}}}$ is also the natural density of the square-free numbers in N. In fact, this is not a coincidence. Consider the k-dimensional lattice, ${\displaystyle \mathbb {Z} ^{k}}$. The natural density of the points which are visible from the origin is ${\displaystyle {\frac {1}{\zeta (k)}}}$, which is also the natural density of the k-th free integers in N.

### Divisor functions

Consider the generalization of ${\displaystyle d(n)}$:

${\displaystyle \sigma _{\alpha }(n)=\sum _{d\mid n}d^{\alpha }.}$

The following are true:

${\displaystyle \sum _{n\leq x}\sigma _{\alpha }(n)={\begin{cases}\;\;\sum _{n\leq x}\sigma _{\alpha }(n)={\frac {\zeta (\alpha +1)}{\alpha +1}}x^{\alpha +1}+O(x^{\beta })&{\text{if }}\alpha >0,\\\;\;\sum _{n\leq x}\sigma _{-1}(n)=\zeta (2)x+O(\log x)&{\text{if }}\alpha =-1,\\\;\;\sum _{n\leq x}\sigma _{\alpha }(n)=\zeta (-\alpha +1)x+O(x^{\max(0,1+\alpha )})&{\text{otherwise.}}\end{cases}}}$

where ${\displaystyle \beta =max(1,\alpha )}$.

## Better average order

This notion is best discussed through an example. From

${\displaystyle \sum _{n\leq x}d(n)=x\log x+(2\gamma -1)x+o(x)}$

(${\displaystyle \gamma }$ is the Euler–Mascheroni constant) and

${\displaystyle \sum _{n\leq x}\log n=x\log x-x+O(\log x),}$

we have the asymptotic relation

${\displaystyle \sum _{n\leq x}(d(n)-(\log n+2\gamma ))=o(x)\quad (x\rightarrow \infty ),}$

which suggests that the function ${\displaystyle \log n+2\gamma }$ is a better choice of average order for ${\displaystyle d(n)}$ than simply ${\displaystyle \log n}$.

## Mean values over Fq[x]

### Definition

Let h(x) be a function on the set of monic polynomials over Fq. For ${\displaystyle n\geq 1}$ we define

${\displaystyle {\text{Ave}}_{n}(h)={\frac {1}{q^{n}}}\sum _{f{\text{ monic}},\deg(f)=n}h(f).}$

This is the mean value (average value) of h on the set of monic polynomials of degree n. We say that g(n) is an average order of h if

${\displaystyle {\text{Ave}}_{n}(h)\sim g(n)}$

as n tends to infinity.

In cases where the limit,

${\displaystyle \lim _{n\rightarrow \infty }{\text{Ave}}_{n}(h)=c}$

exists, it is said that h has a mean value (average value) c.

### Zeta function and Dirichlet series in Fq[X]

Let Fq[X]=A be the ring of polynomials over the finite field Fq.

Let h be a polynomial arithmetic function (i.e. a function on set of monic polynomials over A). Its corresponding Dirichlet series define to be

${\displaystyle D_{h}(s)=\sum _{f{\text{ monic}}}h(f)|f|^{-s},}$

where for ${\displaystyle g\in A}$, set ${\displaystyle |g|=q^{deg(g)}}$ if ${\displaystyle g\neq 0}$, and ${\displaystyle |g|=0}$ otherwise.

The polynomial zeta function is then

${\displaystyle \zeta _{A}(s)=\sum _{f{\text{ monic}}}|f|^{-s}.}$

Similar to the situation in N, every Dirichlet series of a multiplicative function h has a product representation (Euler product):

${\displaystyle D_{h}(s)=\prod _{P}(\sum _{n{\mathop {=}}0}^{\infty }h(P^{n})|P|^{-sn}),}$

Where the product runs over all monic irreducible polynomials P.

For example, the product representation of the zeta function is as for the integers: ${\displaystyle \zeta _{A}(s)=\prod _{P}(1-|P|^{-s})^{-1}}$.

Unlike the classical zeta function, ${\displaystyle \zeta _{A}(s)}$ is a simple rational function:

${\displaystyle \zeta _{A}(s)=\sum _{f}(|f|^{-s})=\sum _{n}\sum _{\text{deg(f)=n}}q^{-sn}=\sum _{n}(q^{n-sn})=(1-q^{1-s})^{-1}.}$

In a similar way, If ƒ and g are two polynomial arithmetic functions, one defines ƒ * g, the Dirichlet convolution of ƒ and g, by

{\displaystyle {\begin{aligned}(f*g)(m)&=\sum _{d\,\mid \,m}f(m)g\left({\frac {m}{d}}\right)\\&=\sum _{ab\,=\,m}f(a)g(b)\end{aligned}}}

where the sum extends over all monic divisors d of m, or equivalently over all pairs (a, b) of monic polynomials whose product is m. The identity ${\displaystyle D_{h}D_{g}=D_{h*g}}$ still holds. Thus, like in the elementary theory, the polynomial Dirichlet series and the zeta function has a connection with the notion of mean values in the context of polynomials. The following examples illustrate it.

### Examples

#### The density of the k-th power free polynomials in Fq[X]

Define ${\displaystyle \delta (f)}$ to be 1 if ${\displaystyle f}$ is k-th power free and 0 otherwise.

We calculate the average value of ${\displaystyle \delta }$, which is the density of the k-th power free polynomials in Fq[X], in the same fashion as in the integers.

By multiplicativity of ${\displaystyle \delta }$:

${\displaystyle \sum _{f}{\frac {\delta (f)}{|f|^{s}}}=\prod _{P}(\sum _{j{\mathop {=}}0}^{k-1}(|P|^{-js}))=\prod _{P}{\frac {1-|P|^{-sk}}{1-|P|^{-s}}}={\frac {\zeta _{A}(s)}{\zeta _{A}(sk)}}={\frac {1-q^{1-ks}}{1-q^{1-s}}}={\frac {\zeta _{A}(s)}{\zeta _{A}(ks)}}}$

Denote ${\displaystyle b_{n}}$ the number of k-th power monic polynomials of degree n, we get

${\displaystyle \sum _{f}{\frac {\delta (f)}{|f|^{s}}}=\sum _{n}\sum _{{\text{def}}f=n}\delta (f)|f|^{-s}=\sum _{n}b_{n}q^{-sn}.}$

Making the substitution ${\displaystyle u=q^{-s}}$ we get:

${\displaystyle {\frac {1-qu^{k}}{1-qu}}=\sum _{n{\mathop {=}}0}^{\infty }b_{n}u^{n}.}$

Finally, expand the left-hand side in a geometric series and compare the coefficients on ${\displaystyle u^{n}}$ on both sides, to conclude that

${\displaystyle b_{n}={\begin{cases}\;\;\,q^{n}&n\leq k-1\\\;\;\,q^{n}(1-q^{1-k})&{\text{otherwise}}\end{cases}}}$

Hence,

${\displaystyle {\text{Ave}}_{n}(\delta )=1-q^{1-k}={\frac {1}{\zeta _{A}(k)}}}$

And since it doesn't depend on n this is also the mean value of ${\displaystyle \delta (f)}$.

#### Polynomial Divisor functions

In Fq[X], we define

${\displaystyle \sigma _{k}(m)=\sum _{f|m,{\text{ monic}}}|f|^{k}.}$

We will compute ${\displaystyle {\text{Ave}}_{n}(\sigma _{k})}$ for ${\displaystyle k\geq 1}$.

First, notice that

${\displaystyle \sigma _{k}(m)=h*\mathbb {I} (m)}$

where ${\displaystyle h(f)=|f|^{k}}$ and ${\displaystyle \;\mathbb {I} (f)=1\;\;\forall {f}}$.

Therefore,

${\displaystyle \sum _{m}\sigma _{k}(m)|m|^{-s}=\zeta _{A}(s)\sum _{m}h(m)|m|^{-s}.}$

Substitute ${\displaystyle q^{-s}=u}$ we get,

${\displaystyle {\text{LHS}}=\sum _{n}(\sum _{\deg(m)=n}\sigma _{k}(m))u^{n}}$, and by Cauchy product we get,
{\displaystyle {\begin{aligned}{\text{RHS}}&=\sum _{n}q^{n(1-s)}\sum _{n}(\sum _{\deg(m)=n}h(m))u^{n}\\&=\sum _{n}q^{n}u^{n}\sum _{l}q^{l}q^{lk}u^{l}\\&=\sum _{n}(\sum _{j{\mathop {=}}0}^{n}q^{n-j}q^{jk+j})\\&=\sum _{n}(q^{n}({\frac {1-q^{k(n+1)}}{1-q^{k}}}))u^{n}.\end{aligned}}}

Finally we get that,

${\displaystyle {\text{Ave}}_{n}\sigma _{k}={\frac {1-q^{k(n+1)}}{1-q^{k}}}.}$

Notice that

${\displaystyle q^{n}{\text{Ave}}_{n}\sigma _{k}=q^{n(k+1)}({\frac {1-q^{-k(n+1)}}{1-q^{-k}}})=q^{n(k+1)}({\frac {\zeta (k+1)}{\zeta (kn+k+1)}})}$

Thus, if we set ${\displaystyle x=q^{n}}$ then the above result reads

${\displaystyle \sum _{\deg(m)=n,m{\text{ monic}}}\sigma _{k}(m)=x^{k+1}({\frac {\zeta (k+1)}{\zeta (kn+k+1)}})}$

which resembles the analogous result for the integers:

${\displaystyle \sum _{n\leq x}\sigma _{k}(n)={\frac {\zeta (k+1)}{k+1}}x^{k+1}+O(x^{k})}$

#### Number of divisors

Let ${\displaystyle d(f)}$ be the number of monic divisors of f and let ${\displaystyle D(n)}$ be the sum of ${\displaystyle d(f)}$ over all monics of degree n.

${\displaystyle \zeta _{A}(s)^{2}=(\sum _{h}|h|^{-s})(\sum _{g}|g|^{-s})=\sum _{f}(\sum _{hg=f}1)|f|^{-s}=\sum _{f}d(f)|f|^{-s}=D_{d}(s)=\sum _{n{\mathop {=}}0}^{\infty }D(n)u^{n}}$

where ${\displaystyle u=q^{-s}}$.

Expanding the right-hand side into power series we get,

${\displaystyle D(n)=(n+1)q^{n}.}$

Substitute ${\displaystyle x=q^{n}}$ the above equation becomes:

${\displaystyle D(n)=x\log _{q}(x)+x}$ which resembles closely the analogous result for integers ${\displaystyle \sum _{k{\mathop {=}}1}^{n}d(k)=x\log x+(2\gamma -1)x+O({\sqrt {x}})}$, where ${\displaystyle \gamma }$ is Euler constant.

It is interesting to note that not a lot is known about the error term for the integers, while in the polynomials case, there is no error term! This is because of the very simple nature of the zeta function ${\displaystyle \zeta _{A}(s)}$, and that it has NO zeros.

#### Polynomial von Mangoldt function

The Polynomial von Mangoldt function is defined by: ${\displaystyle \Lambda _{A}(f)={\begin{cases}\log |P|&{\mbox{if }}f=|P|^{k}{\text{ for some prime monic}}P{\text{ and integer }}k\geq 1,\\0&{\mbox{otherwise.}}\end{cases}}}$

Where the logarithm is taken on the basis of q.

Proposition. The mean value of ${\displaystyle \Lambda _{A}}$ is exactly 1.

Proof. Let m be a monic polynomial, and let ${\displaystyle m=\prod _{i{\mathop {=}}1}^{l}P_{i}^{e_{i}}}$ be the prime decomposition of m.

We have,

{\displaystyle {\begin{aligned}\sum _{f|m}\Lambda _{A}(f)&=\sum _{(i_{1},\ldots ,i_{l})|0\leq i_{j}\leq e_{j}}\Lambda _{A}(\prod _{j{\mathop {=}}1}^{l}P_{j}^{i_{j}})=\sum _{j{\mathop {=}}1}^{l}\sum _{i{\mathop {=}}1}^{e_{i}}\Lambda _{A}(P_{j}^{i})=\sum _{j{\mathop {=}}1}^{l}\sum _{i{\mathop {=}}1}^{e_{i}}\log |P_{j}|\\&=\sum _{j{\mathop {=}}1}^{l}e_{j}\log |P_{j}|=\sum _{j{\mathop {=}}1}^{l}\log |P_{j}|^{e_{j}}=\log |(\prod _{i{\mathop {=}}1}^{l}P_{i}^{e_{i}})|\\&=\log(m)\end{aligned}}}

Hence,

${\displaystyle \mathbb {I} \cdot \Lambda _{A}(m)=\log |m|}$

and we get that,

${\displaystyle \zeta _{A}(s)D_{\Lambda _{A}}(s)=\sum _{m}log|m||m|^{-s}.}$

Now,

${\displaystyle \sum _{m}|m|^{s}=\sum _{n}\sum _{\deg m=n}u^{n}=\sum _{n}q^{n}u^{n}=\sum _{n}q^{n(1-s)}.}$

Thus,

${\displaystyle {\frac {d}{ds}}\sum _{m}|m|^{s}=-\sum _{n}\log(q^{n})q^{n(1-s)}=-\sum _{n}\sum _{\deg(f)=n}\log(q^{n})q^{-ns}=-\sum _{f}\log |f||f|^{-s}.}$

We got that:

${\displaystyle D_{\Lambda _{A}}(s)={\frac {-\zeta '_{A}(s)}{\zeta _{A}(s)}}}$

Now,

${\displaystyle \sum _{m}\Lambda _{A}(m)|m|^{-s}=\sum _{n}(\sum _{\deg(m)=n}\Lambda _{A}(m)q^{-sm})=\sum _{n}(\sum _{\deg(m)=n}\Lambda _{A}(m))u^{n}={\frac {-\zeta '_{A}(s)}{\zeta _{A}(s)}}={\frac {q^{1-s}log(q)}{1-q^{1-s}}}=\log(q)\sum _{n{\mathop {=}}1}^{\infty }q^{n}u^{n}}$

Hence,

${\displaystyle \sum _{\deg(m)=n}\Lambda _{A}(m)=q^{n}\log(q),}$

and by dividing by ${\displaystyle q^{n}}$ we get that,

${\displaystyle {\text{Ave}}_{n}\Lambda _{A}(m)=\log(q)=1.}$

#### Polynomial Euler totient function

Define Euler totient function polynomial analogue, ${\displaystyle \Phi }$, to be the number of elements in the group ${\displaystyle (A/fA)^{*}}$. We have,

${\displaystyle \sum _{\deg f=n,f{\text{ monic}}}\Phi (f)=q^{2n}(1-q^{-1}).}$