# Asymptotics of $\sum_{n\leq x}d(kn)$ where $k$ is composite

As shown by @NoamD.Elkies here, $\sum_{n \leq x} d(kn)$ can be reduced to a linear combination of values of $D$ at multiples of $x$ (where $D(x)=\sum_{n\leq x}d(n)$ is the sum of the number of divisors less than $x$), so \begin{align} &\sum_{n \leq x} d(pn) = 2D(x) - D(x/p), \ p\in\mathbb{P}\\ \end{align}

which gives us

\begin{align} &\sum_{n \leq x} d(2n) = 2D(x) - D(x/2)\sim x (3 \log (x)+6 \gamma -3+\log (2))/2\\ &\sum_{n \leq x} d(3n) = 2D(x) - D(x/3)\sim x (5 \log (x)+10 \gamma -5+\log (3))/3\\ &\sum_{n \leq x} d(5n) = 2D(x) - D(x/5)\sim x (9 \log (x)+18 \gamma -9+\log (5))/5\\ &\vdots \end{align}

but for composite $k$ things seem a little less straightforward:

\begin{align} &\sum_{n \leq x} d(4n) = 3D(x) - 2D(x/2)\sim x (2 \log (x)+4 \gamma -2+\log (2))\\ &\sum_{n \leq x} d(6n) = ?\\ \end{align}

How can $\sum_{n \leq x} d(6n)$ be written in this form? Is there a general way to find the linear combination for composite $k$?

## 2 Answers

$\sum_{n\leq x} d(6n) = 4D(x) - 2D(x/2) - 2D(x/3) + D(x/6)$, which should suggest the general pattern for $k$ squarefree.

• I have found the general solution, which is simple to code (below), but difficult to put in standard notation. Is there a simple way of doing this? – martin Jan 24 '16 at 6:23

I am answering this question largely for my own records, but also posting incase useful to anybody else. Easy to code, difficult to put in standard notation:

ds[n_, x_] :=
If[n == 1, {{1, 0}, {1, 1}},
With[{a = Transpose@FactorInteger[n]},
With[{b = Times @@@ Subsets[a[[1]]]},
With[{c = x[#] & /@ Range@Length@a[[2]]},
Total[#[[2]] Sum[DivisorSigma[0, k], {k, 1, x/#[[1]]}] & /@
Transpose@{b, (-1)^PrimeOmega@b Reverse[(-1)^PrimeNu@n Total[
Times @@@ #] & /@ -(aa[c, #] & /@ Subsets[c] /.
Thread[c -> a[[2]] + 1])]}]]]]]

With[{n = 24}, {ds[n, #] & /@ Range@10,
Sum[DivisorSigma[0, n k], {k, 1, #}] & /@ Range@10}] // Column

(*
{8, 18, 30, 42, 58, 73, 89, 103, 119, 139}
{8, 18, 30, 42, 58, 73, 89, 103, 119, 139}
*)