Asymptotic growth of summation of $\sum_{j\leq t}' 2^{\omega(j)}$ (restricting sum to a certain subset of $j$) The following question came up in a thesis discussion I had with a student (undergraduate). I am a number theory researcher, but not within analytic number theory. One challenge I have faced is not having good intuition for what the answers should be (unless I see clearly a proof, which then creates a vicious circle!).
Here is the question asked in its most basic form. Recall that $\omega(n)$ is used to denote the number of distinct prime divisors of $n$. Let me call an integer $n$ good if for all primes $p \mid n$, we have $p \equiv \pm 1 \pmod{8}$.
What is the asymptotic behavior of $\displaystyle D(t) = \sum_{\substack{n\leq t\\\text{$n$ good}}} 2^{\omega(n)}?$
What I seem to be able to see right now is that $D(t) = ct + o(t^{3/4})$ where $c = \frac{2\sqrt{2}\log(1+\sqrt{2})}{\pi^2}$ (see below). The issue is that the error term seems grossly overestimated. So, I am turning to you all to ask what better trained people can say about the sum $D(t)$.
Now I explain where this arises and what I know. The sum $D(t)$ arises from counting a certain set of ideals in the algebraic integer ring $\mathbf Z[\sqrt 2]$. Namely, $D(t)$ counts the number of pairs of ideals $I,J \subseteq \mathbf Z[\sqrt 2]$ such that $N(I) = N(J)$ and $\gcd(I,J) = 1$. Here $N(I)$ is the ideal norm (if $I$ is generated by $a+b\sqrt{2}$ then $N(I) = |a^2-2b^2|$).
Second, I know just enough technique from analytic number theory to consider the Dirichlet series
$$
F(s) = \sum_{\substack{n\geq 1\\ \text{$n$ is good}}} \frac{2^{\omega(n)}}{n^s}.
$$
This factors nicely into
$$
F(s) = \zeta(s)G(s),
$$
where
$$
G(s) = \prod_{p\equiv \pm 1 \pmod{8}} (1 + p^{-s}) \times \prod_{p\not\equiv \pm 1 \pmod{8}} (1-p^{-s}) = \frac{1-2^{-s}}{1-2^{-2s}}\frac{L(s,\chi_8)}{\zeta(2s)}.
$$
Here, $\chi_8$ is the Dirichet character modulo $8$ that sends $1,7 \mapsto 1$ and $3,5 \mapsto -1$. I guess I should say $\zeta(s)$ is Riemann's zeta function. (Without the restriction to $n$ being good, the series $F(s)$ would have factored into $\zeta(s)^2/\zeta(2s)$.)
If I understand correctly, the Dirichlet series $G(s)$ converges on $\mathrm{Re}(s) \geq 1/2$ (the tricky part is that $1/\zeta(s)$ converges at $s = 1$, which is related to the prime number theorem) and so $G(s) = \sum b_n/n^s$ has partial sums that satisfy $\sum_{n\leq t} b_n = o(\sqrt{t})$. Then, using $F(s) = \zeta(s)G(s)$, I used the hyperbola principle (my most advanced trick, to be honest) to see that
$$
D(t) = G(1) t + o(t^{3/4}).
$$
(If I haven't made any mistake, which is a big iff...).
The value of $G(1)$ can be calculated to be $\frac{2\sqrt{2}\log(1+\sqrt{2})}{\pi^2}$ using the famous formula for $\zeta(2)$ and the evaluation of $L(1,\chi_8)$ either by the class number formula or just doing it by hand.
For what it's worth, I plotted $D(t) - ct$ for $t \leq 20000$ (first plot) and $t \leq 100,000$ (second plot) and, well, the difference looks small, way better than just $o(t^{3/4})$ but not as small as $O(1)$...
First plot. Values of $D(t) - ct$ for $t \leq 20000$
Second plot. Values of $D(t) - ct$ for $t \leq 100000$
(apparently noobs cannot post images...)
 A: Let $f(n)$ be the multiplicative function satisfying $f(p^r) = 2$ if $p \equiv \pm 1 \pmod{8}$ and $f(p^r) = 0$ otherwise. Then
$$\sum_{\substack{n = 1 \\\ n \text{ good}}}^{\infty} \frac{2^{\omega(n)}}{n^s} = \sum_{n = 1}^{\infty} \frac{f(n)}{n^s}.$$
This is
$$\prod_p \sum_{r = 0}^{\infty} \frac{f(p^r)}{p^{rs}} = \prod_{p \equiv \pm 1 \pmod{8}} \left(1 + \sum_{r = 1}^{\infty} \frac{2}{p^{rs}}\right) = \prod_{p \equiv \pm 1 \pmod{8}} \frac{1 + p^{-s}}{1 - p^{-s}}.$$
Letting $\chi_8$ denote the quadratic Dirichlet character modulo $8$ that satisfies $\chi_8(1) = \chi_8(7) = 1$ and $\chi_8(3) = \chi_8(5) = -1$, we find that this is
$$\frac{1 - 2^{-s}}{1 - 2^{-2s}} \prod_p \frac{1 - p^{-2s}}{(1 - p^{-s}) (1 - \chi_8(p) p^{-s})} = \frac{1 - 2^{-s}}{1 - 2^{-2s}} \frac{\zeta(s) L(s,\chi_8)}{\zeta(2s)}.$$
This is all valid for $\Re(s) > 1$. Now we use Perron's formula, which states that if $x > 1$ is not an integer,
$$\sum_{n \leq x} f(n) = \frac{1}{2\pi i} \int_{\sigma_0 - i\infty}^{\sigma_0 + i\infty} \frac{1 - 2^{-s}}{1 - 2^{-2s}} \frac{\zeta(s) L(s,\chi_8)}{\zeta(2s)} \frac{x^s}{s} \, ds$$
for any $\sigma_0 > 1$. (If $x$ is an integer, we have to subtract $f(x)/2$.)
We truncate the integral to be from $\sigma_0 - iT$ to $\sigma_0 + iT$ for a parameter $T$ to be chosen, then shift the contour to the left, picking up a residue at the pole at $s = 1$ equal to $\frac{4 L(1,\chi_8)}{\pi^2} x$. This special value can be explicitly determined via the Dirichlet class number formula. The new contour should be chosen to be $\sigma_1 - iT$ to $\sigma_1 + iT$, where $\sigma_1 = 1/2 - c/\log T$ with $c$ a small positive constant chosen to ensure that this is inside the zero-free region for $\zeta(2s)$. In this way, we don't pick up any additional residues at the poles of $1/\zeta(2s)$. Now one estimates the contour integrals using various standard bounds for the integrands and picks the optimal choice of $T$.
This method of proof hopefully should be able to show that
$$\sum_{n \leq x} f(n) = \frac{4 L(1,\chi_8)}{\pi^2} x + O\left(\sqrt{x} e^{-c\sqrt{\log x}}\right)$$
for some absolute constant $c > 0$. Assuming the Riemann hypothesis, one should be able to show that
$$\sum_{n \leq x} f(n) = \frac{4 L(1,\chi_8)}{\pi^2} x + O_{\varepsilon}\left(x^{\frac{1}{4} + \varepsilon}\right).$$
Unconditionally, one can show that this is essentially optimal, in that the error term cannot be $o(x^{1/4})$.
The caveat is that I haven't estimated the contours, which is a nontrivial amount of work (that I can't be bothered doing).
