Analyse the asymptotic behavior of $\sum_{p\leq x} \frac{\log^2(p)}{p}$ This question showed up in a number theory test from previous semesters so I might not know all the material needed to solve this question but here is my try:
The function $f(x)=\frac{\log^2(x)}{x}$ is bounded in $(1,\infty)$ so for some upped bound $C$ on $f(x)$ we have $$\sum_{p\leq x, p\, \text{prime}} \frac{\log^2(p)}{p}\leq C\cdot \pi(x)$$
on the other hand for large enough $x$ we have $\min\left\{\frac{\log^2(p)}{p}|p\leq x, p\, \text{prime}\right\}\geq \frac{\log^2(x)}{x}$ and so:
$$\sum_{p\leq x, p\, \text{prime}} \frac{\log^2(p)}{p}\geq \frac{\log^2(x)}{x} \pi(x)\stackrel{PNT}{=}O(\log(x))$$
Both bounds dont give a tight bound and here I am pretty much stuck.
 A: This isn’t number theory. It really is only analysis.
Note that if $(p_n)_n$ is the increasing sequence of the prime numbers, it’s technically easier to find an equivalent for $S_n=\sum_{k=1}^n{\frac{\ln^2{p_k}}{p_k}}$.
That’s a series, and the general term can be easily (using the PNT) proved equivalent to $\frac{\ln^2{k}}{k\ln{k}}=\frac{\ln{k}}{k}$. In particular, the series is divergent, and thus $S_n \sim \sum_{k=4}^n{\frac{\ln{k}}{k}}$.
Using a series-integral comparison, the sum above can be shown equivalent to $\frac{\ln^2{n}}{2}$.
So the original sum is equivalent to $\frac{\ln^2{\pi(x)}}{2} \sim \frac{\ln^2{x}}{2}$.
A: For convenience, let's define
$$
F(x)=\sum_{p\le x}{\log p\over p}
$$
Then using Riemann-Stieltjes integration we have
$$
\begin{aligned}
\sum_{p\le x}{\log^2p\over p}
&=\int_{2^-}^x\log t\mathrm dF(t)
=F(x)\log x-\int_2^x{F(t)\over t}\mathrm dt \\
&=\log^2x-\int_2^x{\log t\over t}\mathrm dt+[F(x)-\log x]\log x-\int_2^x{F(t)-\log t\over t}\mathrm dt
\end{aligned}
$$
By Mertens' first theorem, we know that $F(x)=\log x+\mathcal O(1)$, so the above formula gets simplified into
$$
\sum_{p\le x}{\log^2p\over p}=\log^2x+\mathcal O(\log x)
$$
