show that $ \sum_{p \leq x} \log p \big( \log x - \log p\big) = O(x) $ Show that:
$$ \sum_{p \leq x} \log p \big( \log x - \log p\big) = O(x) $$
This is not an exercise.  This is implied in one line of proof by Atle Selberg.  Additionally the paper asks to show:
$$ \sum_{p^a \leq x, \; a > 1} \log^2 x = O(x)$$
Since the summand does not depend on $p$, I think this just ammounts to counting prime numbers smaller than $\sqrt{x}, \sqrt[3]{x}$, etc.  Lastly 
$$ \sum_{p^a q^b \leq x , \; a > 1} \log p \log q = O(x)$$
and this depends on $p$ and $q$.  These supposedly can be derived from two formulas.  First sum of log of primes
$$ \sum_{p \leq x} \log p = O(x) $$
and secondly some some of fractions.  I don't know if there is a typo in the paper.  I think it should be the second one, which is Mertens' theorem
$$ \sum_{p \leq x} \frac{\log p}{x}  = \log x + O(1)
\hspace{0.25in}\text{ or }\hspace{0.25in}
 \sum_{p \leq x} \frac{\log p}{p}  = \log x + O(1)$$
 A: There is an elementary proof :
Let $b(n) = \begin{cases}\log n \text{ if } n \text{ is prime}\\0 \text{ otherwise}\end{cases} \quad$  and $\quad$  $\theta(N) =\sum_{n=1}^N b(n)= \sum_{p \le N} \log p$. 


*

*Let $A(n) = {2n+1 \choose n+1}$ it is an integer and $p$ prime divides $A(n)$ whenever $n+1 < p \le 2n+1$ i.e. $$A(n) \ge \prod_{n+1 <p \le 2n+1} p=e^{\theta(2n+1)-\theta(n+1)}$$
also $A(n) =\frac{(2n+1)!}{n!(n+1)!}=\frac{2n(2n+1)}{n(n+1)}A(n-1)$ and $\frac{2n(2n+1)}{n(n+1)}< 4 \implies A(n) \le 4^n$ so that
$$\theta(2n+1)-\theta(n)\le \ln A(n)\le n \log 4\quad \implies\quad \theta(n) \le 2n \log 4=\mathcal{O}(n)$$



Using the summation by parts
$$\sum_{n=1}^N b(n) \log n= \theta(N)\log N -\sum_{n=1}^{N-1}\theta(n) (\log n - \log(n+1))$$
$|\log n - \log(n+1)| = |\log (1-\frac{1}{n+1})|<  \frac{1}{n}$ so that $$\left|\sum_{n=1}^{N-1}\theta(n)  (\log n - \log(n+1))\right| < \sum_{n=1}^{N-1}\frac{\theta(n) }{n} = \mathcal{O}(N)$$ and hence
$$\sum_{p \le N} \log p (\log N - \log p) = \log N \ \theta(N) - \sum_{n=1}^N b(n) \log n$$ $$ = \log N\ \theta(N)-\log N \ \theta(N)+\mathcal{O}(N) = \mathcal{O}(N)$$
