Asymptotic estimate for $\sum_{\substack{ab\le x \\ a,b\in A}}f(a)f(b)$ 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$?
 A: 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.
A: Yes, and you get what should be expected (that is, $\sum_{\substack{|D_1D_2|\le x \\ D_1,D_2 \in A}}1\sim \frac{x\log x}{\zeta(2)^2}$.)
For proving this you may choose $\rho>1$ (close to 1) and partition $A=\sqcup_{k=1}^\infty A_k$, where $A_k=\{u\in A: \rho^{k-1}\leqslant |u|<\rho^k\}$. Then $A_k$ contains $(1+o(1))\rho^{k-1}(\rho-1)/\zeta(2)$ elements of $A$.
The set $\Omega_x:=\{(u,v)\in A\times A\colon |uv|\leqslant x\}$ contains a union of $A_i\times A_j$ for pairs $(i,j)$ with $i+j\leqslant x/\log \rho$ and is contained in the union of $A_i\times A_j$ for which $i+j-2\leqslant x/\log \rho$. This gives a two-sided estimate for $|\Omega_x|$, and left and right bounds are close for $\rho$ close enough to 1.
