Why is $\sum\left(\left\lfloor\frac{x}{p}\right\rfloor+\left\lfloor\frac{x}{p^2}\right\rfloor+\dots\right)\log p=\sum\frac{x}{p}\log p+O(x)$? 
Why is $\sum\limits_{\substack{p:\text{prime}\\p\le x\\}}\left(\left\lfloor\frac{x}{p}\right\rfloor+\left\lfloor\frac{x}{p^2}\right\rfloor+\dots\right)\log p=\sum\limits_{\substack{p:\text{prime}\\p\le x\\}}\frac{x}{p}\log p+O(x)$ ?

It is from here Proposition $4.3$. That the left sum is equal to $\sum\limits_{n\le x}\log n$ is clear, follows from a previous result but the $2$nd equality, I don't get 
 A: We have $$\left\lfloor \frac{x}{p}\right\rfloor =\frac{x}{p}+O\left(1\right)
 $$ then $$\sum_{p\leq x}\left\lfloor \frac{x}{p}\right\rfloor \log\left(p\right)=\sum_{p\leq x}\frac{x}{p}\log\left(p\right)+O\left(\sum_{p\leq x}\log\left(p\right)\right)
 $$ and for each $l\geq2
 $ we have $$\sum_{p\leq x}\left\lfloor \frac{x}{p^{l}}\right\rfloor \log\left(p\right)\ll x\sum_{p\leq x}\frac{\log\left(p\right)}{p^{l}}\leq x\sum_{p\geq1}\frac{\log\left(p\right)}{p^{l}}\ll x
 $$ because the series $\sum_{p\geq1}\frac{\log\left(p\right)}{p^{l}}
 $ is convergent, then $$\sum_{p\leq x}\left(\left\lfloor \frac{x}{p}\right\rfloor +\left\lfloor \frac{x}{p^{2}}\right\rfloor +\dots\right)\log\left(p\right)=\sum_{p\leq x}\frac{x}{p}\log\left(p\right)+O\left(\sum_{p\leq x}\log\left(p\right)\right)+O\left(x\right)
 $$ but we know that $$\theta\left(x\right)=\sum_{p\leq x}\log\left(p\right)\ll x
 $$ then $$\sum_{p\leq x}\left(\left\lfloor \frac{x}{p}\right\rfloor +\left\lfloor \frac{x}{p^{2}}\right\rfloor +\dots\right)\log\left(p\right)=\sum_{p\leq x}\frac{x}{p}\log\left(p\right)+O\left(x\right).
 $$
