Estimating $\sum_{p_2 \leq x} (\log p_2)^2$

This was an exercise to use the approach here to estimate the sum $\sum_{p_2 \leq x} \log (p_2)^2,$ in which $p_2$ are numbers containing two prime factors (repetitions allowed). $\pi_2(x)$ is the number of $p_2$ not exceeding x.

My question is whether I have done anything illegal in adapting this method. The numbers (below) suggest it works. If someone happens to know the correct form of A(x) that would also be appreciated. (Edit: Landau, Handbuch, p.203. I may be able to fill in the error from this.)

$$\sum_{n\leq x} \pi_{2}(n)(\log(n+1)^2-\log(n)^2)$$

$$= \sum_{n\leq x}\pi_2(n)\frac{2\log m}{m}$$

$$= \sum_{n\leq x}( \frac{n\log\log n}{\log n} + O(A ))(\frac{2\log(n)}{n} +O(\frac{\log(n)}{n^2}))$$

$$= 2\log\log n + O(B)$$

Summing by parts:

$$\sum_{p_2\leq x}\log (p_{2})^2 = \sum_{n\leq x} \log(n)^2(\pi_2(n)-\pi_2(n-1))$$

$$= \log(x)^2\pi_2(x) - \sum_{n \leq x}\pi_2(n)(\log(n+1)^2- \log (n)^2)$$

$$= \log(x)^2(\frac{x\log\log x}{\log x} + O(A) ) - c\log\log x + O(B)$$

$$= x\log x \log\log x - c \log\log x + O(C)$$

So the sum of the squares of the logs of the near-primes less than x is asymptotically

$$\sum_{p_2 \leq x} \log(p_{2})^2 \sim x\log x \log\log x$$

Some numbers: $$\begin{array}{r|c|c|c} x&(\sum_{p_2\leq x}\log(p_2)^2) / (x\log x\log\log x)\\ \hline\\ 10000 &0.867 \\ 100000 & 0.918\\ 500000&0.941 \end{array}$$

• Generally better to use \left( ... \right) for complex parentheses. – Thomas Andrews Jun 28 '13 at 15:36

Since the density of $P_2$'s among integers $n < x$ is $$\frac{\log\log x}{\log x}$$ it follows that your sums is asymptotically $$\int_{1}^{x} \frac{\log\log t}{\log t} \cdot (\log t)^2 dt \sim x \log x \log\log x$$ so your result seems correct.
EDIT: By the way the correct bound for $A$ is $\ll x / \log x$.
$$\sum \le x (\log{p})^{2} \sim \int_{1}^{x}\log(t)\,dt$$
because $\pi (n)-\pi(n-1) \sim \frac{1}{\log(n)}$
• $\pi(n)$ is not $\pi_2(n)$ – daniel Jun 28 '13 at 15:50