Elementary Proof of Landau's count on number representable as sum of two squares In Analytic Number Theory by Iwaniec and Kowalski, there is an elementary proof of Landau's result of $\#\{n \le x: \exists a, b,\ s.t.\  n = a^2 + b^2\} \sim Cx/\sqrt{\log x}$ with an explicit constant $C$. However, it is left as exercise 4 in Chapter 1, and the hint is to use Thm 1.1. However, there is a restirction that $\kappa > -1/2$ in Thm 1.1, and if my calculations are correct, no matter whether I select primes congruent to 1 or 3 mod 4, I will have to take $\kappa = -1/2$ in Thm 1.1, which makes the error term as large as the main term. Of course the error term can be made smaller if we use PNT (basically the $O$ becomes $o$), but I feel that it is not the intended approach and is not quite "elementary". Does anyone have any hint?
 A: This is a good question that has been unanswered for a long time!  As Will Jagy mentions, there is a proof in LeVeque but it is not elementary.
Let $f(n)$ be the characteristic function of positive integers that are representable as the sum of two squares.  Then $f(n)$ is multiplicative, but we can't apply Theorem 1.1 directly to $f(n)$.  However, we can apply the theorem to $f(n)/n$, and we get the following asymptotic:
$$\sum_{n \leq x} \frac{f(n)}{n} \sim 2C (\log x)^{1/2},$$
where $C$ is the Landau-Ramanujan constant.
It remains for us to somehow get an asymptotic for $\sum_{n \leq x} f(n)$ using the asymptotic for $\sum_{n \leq x} f(n)/n$.  This seems hard --  summation by parts will not work.
Surprisingly, we can do this if there are some bounds on the growth of $f$ at the prime powers.  There is a very nice lemma from Wirsing's 1961 paper (Hilfssatz 2 on page 93).
Proposition Let $f(n)$ be a multiplicative function such that:
(i) $f(n) \geq 0$,
(ii) $f(p^k) \leq ab^k$ for some $b < 2$ and for all primes $p$ and all $k \geq 2$,
(iii) The sum over the primes has an asymptotic $$\sum_{p \leq x} f(p) \sim \tau \frac{x}{\log x}.$$ Then $$\sum_{n \leq x} f(n) \sim \tau \frac{x}{\log x} \sum_{n \leq x} \frac{f(n)}{n}.$$
The proof of this proposition is entirely elementary, but a bit too long to reproduce here.
Applying this proposition, we can conclude with Landau's formula:
$$\sum_{n \leq x} f(n) \sim C \frac{x}{(\log x)^{1/2}}.$$
