Prove that $\sum\limits_{p\le x\\ p\text{ prime}} \log p= x+O\left(\frac{x}{\log^2 x}\right)$ using Prime Number Theorem Prove that $\displaystyle{\sum\limits_{p\le x\\ p\text{ prime}} \log p= x+O\left(\frac{x}{\log^2 x}\right)}$
Here I'm using Prime number theorem i.e. $\pi(x)=x/\log x+E(x)$ where $E(x)=o(x/\log x)$
Now $\displaystyle{\sum\limits_{p\le x\\ p\text{ prime}} \log p}$
$\displaystyle{=\int\limits_{2-\delta}^x}\log t\ d\pi(t)$
$\displaystyle{=\pi(t)\log t|_{2-\delta}^x-\int\limits_{2-\delta}^x}\frac{\pi(t)}{t}\ dt$
$\displaystyle{=\pi(x)\log x-\int\limits_2^x \frac{\pi(t)}{t}\ dt}$ (taking $\delta\to 0$)
$=x+o(x)+O\left(\int\limits_2^x \frac{1}{\log t}\ dt\right)$
Now I'm able to show that $O\left(\int\limits_2^x \frac{1}{\log t}\ dt\right)=o(x)$ (Just dividing the integral into two intervals $[0,\sqrt{x}]$ and $[\sqrt{x},x]$.
So finally I'm getting $\displaystyle{\sum\limits_{p\le x\\ p\text{ prime}} \log p=x+o(x)}$.
But it's not the form we are asked to prove. Can anyone help me in this regard? Thanks for your help in advance.
 A: It is impossible to use OP's version of PNT to prove the desired result.
In fact, the remainder term looks like this:
$$
E(x)=\pi(x)-{x\over\log x}\asymp{x\over\log^2x}
$$
By partial summation, we have
$$
\vartheta(x)=\sum_{p\le x}\log p=\pi(x)\log x-\int_2^x{\pi(t)\over t}\mathrm dt
$$
However, because
$$
\int_2^x{\pi(t)\over t}\mathrm dt\gg\int_2^x{\mathrm dt\over\log t}\gg{x\over\log x}
$$
Therefore even with the best possible $E(x)$, OP's method can only deduce
$$
\vartheta(x)=x+\mathcal O\left(x\over\log x\right)
$$
On the other hand, if you use a more superior version of prime number theorem:
$$
\pi(x)=\int_2^x{\mathrm dt\over\log t}+\mathcal O\left(xe^{-c\sqrt{\log x}}\right)
$$
where $c$ is an effectively computable positive constant (this is due to de la Vallée Poussin in 1898), then it is possible to improve the remainder term of $\vartheta(x)$ considerably:
\begin{aligned}
\vartheta(x)
&=\int_{2^-}^x\log t\mathrm d\pi(t)=\int_{2^-}^x\mathrm dt+\int_2^x\log t\mathrm d\left\{\mathcal O\left(te^{-c\sqrt{\log t}}\right)\right\} \\
&=x+\mathcal O\left\{x(\log x)e^{-c\sqrt{\log x}}\right\}+\mathcal O\left\{\int_2^xe^{-c\sqrt{\log t}}\mathrm dt\right\}
\end{aligned}
To estimate the remaining integral, we can introduce a square root factor:
$$
\int_2^xe^{-c\sqrt{\log t}}\mathrm dt\le x^{1/2}e^{-c\sqrt{\log x}}\int_2^xt^{-1/2}\mathrm dt\ll xe^{-c\sqrt{\log x}}
$$
Now, we can pick any $c'\in(0,c)$ to obtain the following asymptotic formula:
$$
\vartheta(x)=x+\mathcal O\left(xe^{-c'\sqrt{\log x}}\right)
$$
This error term is a much sharper result than the $\mathcal O(x\log^{-2}x)$ stated by the OP.
