# Sum of the divisor function over integers with restricted prime factors

Let $a,q$ be co-prime integers and let $P(a,q)$ denote the set of primes congruent to $a$ modulo $q$. Is it known whether one can give an asymptotic formula for the expression

$$\displaystyle \sum_{\substack{n \leq x \\ p | n \Rightarrow p \in P(a,q)}} d(n),$$ where $d(n)$ is the number of divisors of $n$?

Sure. The generating function for the sum you want is the Dirichlet series $$\sum_{\substack{ n=1\\p|n \implies p\equiv a\pmod q}}^{\infty} \frac{d(n)}{n^s} = \prod_{p\equiv a\pmod q} \Big(1- \frac{1}{p^s}\Big)^{-2}.$$ Using Dirichlet characters to isolate primes in progressions, you can express this as $$\zeta(s)^{2/\phi(q)} \prod_{\chi \neq \chi_0 \pmod q} L(s,\chi)^{\overline{\chi(a)}/\phi(q)} G(s),$$ for a suitable Euler product $G$ converging absolutely to the right of $1/2$. Now use the Selberg-Delange method (see e.g. Tenenbaum's book). The asymptotic will be of the type $$\sim C x(\log x)^{-1+2/\phi(q)}$$ for a suitable constant $C$.
• Can the constant $C$ be expressed in terms of $a$ and $q$? – Sylvain JULIEN Sep 26 '17 at 15:43
• Yes, it will be $\prod_{\chi \neq \chi_0 \pmod q} L(1,\chi)^{\overline{\chi(a)}/\phi(q)} G(1)$ in the notation of the answer; $G$ can be explicitly written down easily. Tenenbaum's book has all the details. – Greg Martin Sep 26 '17 at 15:51
• Greg forgot to divide by $\Gamma(2/\phi(q))$, but apart from that the constant is what he wrote. – Lucia Sep 26 '17 at 16:57
• I think there is a $2$ missing in the exponent of the $L(s,\chi)$ term. – Stanley Yao Xiao Oct 20 '18 at 11:23