Divisor sum identities

The purpose of this page is to catalog new, interesting, and useful identities related to number-theoretic divisor sums, i.e., sums of an arithmetic function over the divisors of a natural number $$n$$, or equivalently the Dirichlet convolution of an arithmetic function $$f(n)$$ with one:


 * $$g(n) := \sum_{d\mid n} f(d).$$

These identities include applications to sums of an arithmetic function over just the proper prime divisors of $$n$$. We also define periodic variants of these divisor sums with respect to the greatest common divisor function in the form of


 * $$g_m(n) := \sum_{d\mid (m,n)} f(d),\ 1 \leq m \leq n$$

Well-known inversion relations that allow the function $$f(n)$$ to be expressed in terms of $$g(n)$$ are provided by the Möbius inversion formula. Naturally, some of the most interesting examples of such identities result when considering the average order summatory functions over an arithmetic function $$f(n)$$ defined as a divisor sum of another arithmetic function $$g(n)$$. Particular examples of divisor sums involving special arithmetic functions and special Dirichlet convolutions of arithmetic functions can be found on the following pages: here, here, here, here, and here.

Interchange of summation identities
The following identities are the primary motivation for creating this topics page. These identities do not appear to be well-known, or at least well-documented, and are extremely useful tools to have at hand in some applications. In what follows, we consider that $$f,g,h,u,v: \mathbb{N} \rightarrow \mathbb{C}$$ are any prescribed arithmetic functions and that $G(x) := \sum_{n \leq x} g(n)$ denotes the summatory function of $$g(n)$$. A more common special case of the first summation below is referenced here.

\begin{align} \sum_{n=1}^x \sum_{d\mid n} f(d) g\left(\frac{n}{d}\right) & = \sum_{n=1}^x f(n) G\left(\left\lfloor \frac{x}{n} \right\rfloor\right) = \sum_{i=1}^x \left(\sum_{\left\lceil \frac{x+1}{i+1} \right\rceil \leq n \leq \left\lfloor \frac{x-1}{i} \right\rfloor} f(n)\right) G(i) + \sum_{d\mid x} G(d) f\left(\frac{x}{d}\right) \end{align} $$
 * 1) $$\sum_{n=1}^x v(n) \sum_{d\mid n} h(d) u\left(\frac{n}{d}\right) = \sum_{n=1}^x h(n) \sum_{k=1}^{\left\lfloor \frac{x}{n} \right\rfloor} u(k) v(nk) $$
 * 1) $$\sum_{d=1}^x f(d) \left(\sum_{r\mid (d,x)} g(r) h\left(\frac{d}{r}\right)\right) = \sum_{r\mid x} g(r) \left(\sum_{1 \leq d \leq x/r} h(d) f(rd)\right) $$
 * 2) $$\sum_{m=1}^x \left(\sum_{d\mid(m,x)} f(d) g\left(\frac{x}{d}\right)\right) = \sum_{d\mid x} f(d) g\left(\frac{x}{d}\right) \cdot \frac{x}{d} $$
 * 3) $$\sum_{m=1}^x \left(\sum_{d\mid (m,x)} f(d) g\left(\frac{x}{d}\right)\right) t^m = (t^x-1) \cdot \sum_{d\mid x} \frac{t^d f(d)}{t^d-1} g\left(\frac{x}{d}\right) $$

In general, these identities are collected from the so-called "rarities and b-sides" of both well established and semi-obscure analytic number theory notes and techniques and the papers and work of the contributors. The identities themselves are not difficult to prove and are an exercise in standard manipulations of series inversion and divisor sums. Therefore, we omit their proofs here.

The convolution method
The convolution method is a general technique for estimating average order sums of the form


 * $$\sum_{n \leq x} f(n) \qquad\text{ or } \qquad \sum_{\stackrel{q \leq x}{q\text{ squarefree}}} f(q), $$

where the multiplicative function f can be written as a convolution of the form $$f(n) = (g \ast h)(n)$$ for suitable, application-defined arithmetic functions g and h. A short survey of this method can be found here.

A related technique is the use of the formula
 * $$\sum_{k=1}^n f(k) = \sum_{k=1}^n \sum_{xy=k}^{} g(x)h(y)

= \sum_{x=1}^a \sum_{y=1}^{n/x} g(x)h(y) + \sum_{y=1}^b \sum_{x=1}^{n/y} g(x)h(y) - \sum_{x=1}^a \sum_{y=1}^b g(x)h(y);$$ this is known as the Dirichlet hyperbola method.

Periodic divisor sums
An arithmetic function is periodic (mod k), or k-periodic, if $$f(n+k) = f(n)$$ for all $$n \in \mathbb{N}$$. Particular examples of k-periodic number theoretic functions are the Dirichlet characters $$f(n) = \chi(n)$$ modulo k and the greatest common divisor function $$f(n) = (n, k)$$. It is known that every k-periodic arithmetic function has a representation as a finite discrete Fourier series of the form


 * $$f(n) = \sum_{m=1}^k a_k(m) e\left(\frac{mn}{k}\right), $$

where the Fourier coefficients $$a_k(m)$$ defined by the following equation are also k-periodic:


 * $$a_k(m) = \frac{1}{k} \sum_{n=1}^k f(n) e\left(-\frac{mn}{k}\right). $$

We are interested in the following k-periodic divisor sums:


 * $$s_k(n) := \sum_{d\mid (n,k)} f(d) g\left(\frac{k}{d}\right) = \sum_{m=1}^k a_k(m) e\left(\frac{mn}{k}\right). $$

It is a fact that the Fourier coefficients of these divisor sum variants are given by the formula


 * $$a_k(m) = \sum_{d\mid (m,k)} g(d) f\left(\frac{k}{d}\right) \frac{d}{k}. $$

Fourier transforms of the GCD
We can also express the Fourier coefficients in the equation immediately above in terms of the Fourier transform of any function h at the input of $$\operatorname{gcd}(n, k)$$ using the following result where $$c_q(n)$$ is a Ramanujan sum (cf. Fourier transform of the totient function):


 * $$F_h(m, n) = \sum_{k=1}^{n} h((k,n)) e\left(-\frac{km}{n}\right) = (h \ast c_{\bullet}(m))(n). $$

Thus by combining the results above we obtain that


 * $$a_k(m) = \sum_{d\mid(m,k)} g(d) f\left(\frac{k}{d}\right) \frac{d}{k} = \sum_{d\mid k} \sum_{r\mid d} f(r) g(d) c_{\frac{d}{r}}(m). $$

Sums over prime divisors
Let the function $$a(n)$$ denote the characteristic function of the primes, i.e., $$a(n) = 1$$ if and only if $$n$$ is prime and is zero-valued otherwise. Then as a special case of the first identity in equation (1) in section interchange of summation identities above, we can express the average order sums


 * $$\sum_{n=1}^x \sum_{\stackrel{p\mid n}{p\text{ prime}}} f(p) = \sum_{p=1}^x a(p) f(p) \left\lfloor \frac{x}{p} \right\rfloor =

\sum_{\stackrel{p=1}{p\text{ prime}}}^x f(p) \left\lfloor \frac{x}{p} \right\rfloor. $$

We also have an integral formula based on Abel summation for sums of the form


 * $$\sum_{\stackrel{p=1}{p\text{ prime}}}^x f(p) = \pi(x) f(x) - \int_2^x \pi(t) f^{\prime}(t) dt \approx

\frac{x f(x)}{\log x} - \int_2^x \frac{t}{\log t} f^{\prime}(t) dt, $$

where $$\pi(x) \sim \frac{x}{\log x}$$ denotes the prime-counting function. Here we typically make the assumption that the function f is continuous and differentiable.

Some lesser appreciated divisor sum identities
We have the following divisor sum formulas for f any arithmetic function and g completely multiplicative where $$\varphi(n)$$ is Euler's totient function and $$\mu(n)$$ is the Möbius function:


 * 1) $$\sum_{d\mid n} f(d) \varphi\left(\frac{n}{d}\right) = \sum_{k=1}^n f(\operatorname{gcd}(n, k)) $$
 * 2) $$\sum_{d\mid n} \mu(d) f(d) = \prod_{\stackrel{p\mid n}{p\text{ prime}}} (1-f(p)) $$
 * 3) $$f(m)f(n) = \sum_{d\mid (m,n)} g(d) f\left(\frac{mn}{d^2}\right). $$
 * 4) If f is completely multiplicative then the pointwise multiplication $$\cdot$$ with a Dirichlet convolution yields $$f \cdot (g \ast h) = (f \cdot g) \ast (f \cdot h)$$.
 * 5) $$\sum_{d^k\mid n} \mu(d) = \Biggl\{\begin{array}{ll} 0, & \text{ if } m^k\mid n \text{ for some } m>1; \\ 1, & \text{otherwise.}\end{array}$$
 * 6) If $$m \geq 1$$ and n has more than m distinct prime factors, then $$\sum_{d\mid n} \mu(d) \log^m(d) = 0.$$

The Dirichlet inverse of an arithmetic function
We adopt the notation that $$\varepsilon(n) = \delta_{n,1}$$ denotes the multiplicative identity of Dirichlet convolution so that $$ (\varepsilon \ast f)(n) = (f \ast \varepsilon)(n) = f(n)$$ for any arithmetic function f and $$n \geq 1$$. The Dirichlet inverse of a function f satisfies $$(f \ast f^{-1})(n) = (f^{-1} \ast f)(n) = \varepsilon(n)$$ for all $$n \geq 1$$. There is a well-known recursive convolution formula for computing the Dirichlet inverse $$f^{-1}(n)$$ of a function f by induction given in the form of


 * $$f^{-1}(n) = \Biggl\{\begin{array}{ll} \frac{1}{f(1)}, & \text{ if } n = 1; \\ -\frac{1}{f(1)} \sum_{\stackrel{d\mid n}{d>1}} f(d) f^{-1}\left(\frac{n}{d}\right), & \text{ if } n>1. \end{array}$$

For a fixed function f, let the function $$f_{\pm}(n) := (-1)^{\delta_{n,1}} f(n) = \Biggl\{\begin{matrix} -f(1), & \text{ if } n=1; \\ f(n), & \text{ if } n>1 \end{matrix}$$

Next, define the following two multiple, or nested, convolution variants for any fixed arithmetic function f:



\begin{align} \widetilde{\operatorname{ds}}_{j,f}(n) & := \underbrace{\left(f_{\pm} \ast f \ast \cdots \ast f\right)}_{j\text{ times}}(n) \\ \operatorname{ds}_{j,f}(n) & := \Biggl\{\begin{array}{ll} f_{\pm}(n), & \text{ if } j=1; \\ \sum\limits_{\stackrel{d\mid n}{d>1}} f(d) \operatorname{ds}_{j-1,f}(n/d), & \text{ if } j > 1. \end{array} \end{align} $$

The function $$D_f(n)$$ by the equivalent pair of summation formulas in the next equation is closely related to the Dirichlet inverse for an arbitrary function f.


 * $$D_f(n) := \sum_{j=1}^n \operatorname{ds}_{2j,f}(n) = \sum_{m=1}^{\left\lfloor \frac{n}{2} \right\rfloor} \sum_{i=0}^{2m-1} \binom{2m-1}{i} (-1)^{i+1} \widetilde{\operatorname{ds}}_{i+1,f}(n)$$

In particular, we can prove that


 * $$f^{-1}(n) = \left(D + \frac{\varepsilon}{f(1)}\right)(n).$$

A table of the values of $$D_f(n)$$ for $$2 \leq n \leq 16$$ appears below. This table makes precise the intended meaning and interpretation of this function as the signed sum of all possible multiple k-convolutions of the function f with itself.

Let $$p_k(n) := p(n-k)$$ where p is the Partition function (number theory). Then there is another expression for the Dirichlet inverse given in terms of the functions above and the coefficients of the q-Pochhammer symbol for $$ n > 1$$ given by


 * $$f^{-1}(n) = \sum_{k=1}^{n} \left[(p_k \ast \mu)(n) + (p_k \ast D_f \ast \mu)(n)\right] \times [q^{k-1}] \frac{(q; q)_{\infty}}{1-q}.$$