Sum of an arithmetic sequence involving Euler factors I am trying to find an asymptotic formula for the following sum as $T \to \infty$.
$$ \sum_{t = 1}^{T} \prod_{\substack{p \; \textrm{prime} \\ p | t}} \rho(p) \frac{1 - \frac{1}{p^2}}{1 - \frac{\rho(p)}{p^2}}$$
where for a fixed even $c$, $\rho$ is defined on the primes as follows,
$$ \rho(p) = \begin{cases}
1 + \left( \frac{c}{p} \right) &  (c, p) = 1\\
0 & \textrm{otherwise}
\end{cases} $$
So $\rho(p) = 2$ if $c$ is a quadratic residue of $p$ and $0$ otherwise. Note that the summand is multiplicative.
I tried breaking it into sub sums based on the number of prime factors and whether $t$ is a quadratic residue of small primes. But did not achieve much success.
I did some experiments on the computer, and it shows that the sum is asymptotic to $AT$ for some constant $A = A(c)$.
Edit: I am considering the sum only for $c$ not a perfect square.
 A: Let $c = 2^k m$ with $m$ odd. The analysis is slightly different depending on the parity of $k$ and on whether $m\equiv 1$ or $3\ \text{mod} 4$. For simplicity, I'll assume $k$ is even, $m\equiv 1\ \text{mod 4}$, and $m$ not a perfect square. In this case, quadratic reciprocity gives
$$
\rho(p) = 1 + \chi(p)
$$
whenever $(p,2m)=1$. Here $\chi$ denotes the quadratic Dirichlet character $(\frac{\cdot}{m})$. Let $f(n)$ denote the summand and consider the associated Dirichlet series
$$
D(s) = \sum_{n=1}^\infty \frac{f(n)}{n^s}.
$$
By Perron's formula, we expect
$$
\sum_{t=1}^T f(t) \sim \underset{s=1}{\text{Res}}\ \frac{D(s)T^s}{s}.
$$
Since $f$ is multiplicative, $D(s)$ admits an Euler product, and the goal now is to manipulate this Euler product into an expression involving known $L$-functions, along with some (potentially complicated) arithmetic factors. In this case, it will involve the Dirichlet $L$-function associated to $\chi$, the Riemann zeta function, and some other arithmetic factors. To see this, note that we can write, for $(n,2m)=1$,
$$
f(n) = \prod_{p\mid n} \left(1+\chi(p) + \frac{\rho(p)}{p^2-\rho(p)}\right).
$$
This can be rewritten as a divisor sum
$$
\tag{1}
f(n) = \sum_{d\mid n} \mu^2(d) g(d),
$$
where $g$ is the multiplicative function defined by
$$
g(p) = \chi(p) + \frac{\rho(p)}{p^2-\rho(p)}.
$$
Using convolution notation, we have $f = 1\ast \mu^2 g$. The nice thing about this is that if $f = g\ast h$ and $D_f(s), D_g(s), D_h(s)$ are the Dirichlet series associated with $f,g,h$, respectively, then $D_f(s) = D_g(s) D_h(s)$. Thus the representation (1) shows that our Dirichlet series $D(s)$ has the form
$$
D(s) = \zeta(s) \prod_{p\mid 2m} \left(1-\frac{1}{p^s}\right) \prod_{(p,2m)=1} \left(1 + \frac{\chi(p)}{p^s} +\frac{\frac{\rho(p)}{p^2-\rho(p)}}{p^s} \right).
$$
The last term in the second product behaves nicely for $\text{Re}(s) > -1$, so we rewrite this in the form
$$
D(s) = \zeta(s) \prod_{(p,2m)=1} \left(1 + \frac{\chi(p)}{p^s}\right) H(s),
$$
where $H(s)$ is given by
$$
\begin{aligned}
H(s) &= \prod_{p\mid 2m} \left(1-\frac{1}{p^s}\right) \prod_{(p,2m)=1} \left(1 + \frac{\chi(p)}{p^s} +\frac{\frac{\rho(p)}{p^2-\rho(p)}}{p^s} \right) \left(1 + \frac{\chi(p)}{p^s}\right)^{-1} \\
&= \prod_{p\mid 2m} \left(1-\frac{1}{p^s}\right)\prod_{(p,2m)=1} \left(1 + \frac{\rho(p)}{(p^2-\rho(p)(p^s + \chi(p))} \right).
\end{aligned}
$$
The main feature of $H$ is that is converges absolutely in the half plane $\text{Re}(s) > -1$. We now write
$$
\begin{aligned}
\prod_{(p,2m)=1} \left(1 + \frac{\chi(p)}{p^s}\right) &= \prod_{(p,2m)=1} \left(1 - \frac{\chi(p)^2}{p^{2s}}\right)\left(1 - \frac{\chi(p)}{p^{s}}\right)^{-1} \\
&= \frac{L(s,\chi)}{\zeta(2s)} \left(1 - \frac{\chi(2)}{2^{s}}\right)\prod_{p\mid 2m} \left(1 - \frac{1}{p^{2s}}\right)^{-1}.
\end{aligned}
$$
Thus
$$
D(s) = \frac{L(s,\chi)}{\zeta(2s)} G(s),
$$
where $G(s)$ is given by
$$
G(s) = H(s)\left(1 - \frac{\chi(2)}{2^{s}}\right)\prod_{p\mid 2m} \left(1 - \frac{1}{p^{2s}}\right)^{-1}.
$$
Since $m$ is not a square, $L(s,\chi)$ has no pole at $s=1$, and so $D(s)$ has only a simple pole at $s=1$. Therefore
$$
\tag{2}
\underset{s=1}{\text{Res}}\ \frac{D(s)T^s}{s} = T \left(\frac{L(1,\chi)}{\zeta(2)}\right) G(1).
$$
The calculation is slightly different in the other cases. This comes from the fact that quadratic reciprocity works out slightly differently in these cases.
I should note that all of this can be made fully rigorous, so in the case dealt with above, your sum is (provably) asymptotic to the expression on the right of (2).
