Suppose that $A\subseteq \mathbb{N}$ and suppose that you have an estimate of the form
$$
\sum\_{\substack{a\le x \\ a\in A}}f(a) \sim g(x).
$$
With this information is it possible to get an asymptotic estimate for $\sum\_{\substack{ab\le x \\ a,b\in A}}f(a)f(b)$? I would appreciate any reference in this kind of problem.


For example if $A$ is the set of prime numbers and $f(a)=1$, then we know that
$$
\sum\_{p\le x} 1 =\pi(x)\sim \frac{x}{\log{x}}.
$$
Now,
$$
\sum\_{pq\le x}1=\pi\_2(x)=\sum\_{j=1}^{\pi(x^{1/2})}\left[\pi\left(\frac{x}{p\_j}\right)-j+1\right]
$$
so that (after some calculations)
$$
\sum\_{pq\le x} 1 =\pi\_2(x)\sim \frac{x\log{\log{x}}}{\log{x}}
$$
So I was wondering if it's possible to generalize without relying too much on properties about $A$. The case I'm currently interested is when $A$ is the set of fundamental discriminants. In this case, we know that
$$
\sum\_{\substack{|D|\le x \\ D\in A}} 1\sim \frac{x}{\zeta(2)} .
$$
With this information is it possible to get an estimate for $\sum\_{\substack{|D\_1D\_2|\le x \\ D\_1,D\_2 \in A}}1$?



Asymptotic estimate for $\sum_{\substack{ab\le x \\ a,b\in A}}f(a)f(b)$
I address your first (general) question, but I am sure it is applicable to your second (specialized) question. (Please restrict to one question per post to avoid confusion and frustration.)


You can try to apply Dirichlet's hyperbola method. First, you can forget about $A$, since you can always re-define $f$ as the restriction of $f$ to $A$. Then,
$$\sum\_{ab\leq x}f(a)f(b)=\sum\_{a\leq\sqrt{x}}f(a)\sum\_{b\leq x/a}f(b)+\sum\_{b\leq\sqrt{x}}f(b)\sum\_{a\leq x/b}f(b)-\sum\_{a,b\leq\sqrt{x}}f(a)f(b).$$
That is, if $s$ is the summatory function of $f$, then
$$\sum\_{ab\leq x}f(a)f(b)=2\sum\_{a\leq\sqrt{x}}f(a)s(x/a)-s(\sqrt{x})^2.$$
If $s$ is sufficiently regular (e.g. as in the case of the prime counting function), then the sum on the right-hand side can be evaluated rather directly in terms of $s$: write the sum as
$$\int\_{1-}^{\sqrt{x}} s(x/t)\,ds(t)=s(\sqrt{x})^2-\int\_{1-}^{\sqrt{x}}s(t)\,ds(x/t),$$
and approximate $s$ by a smooth function.


