Show that $\sum\limits_pa_p$ converges iff $\sum\limits_{n}\frac{a_n}{\log n}$ converges I am going through A. J. Hildebrand's lecture notes on Introduction to Analytic Number Theory. I'm currently stuck at the exercises at the end of Chapter 3 (Distribution of Primes I - Elementary Results). The problem statement is:

Let $(a_n)$ be a nonincreasing sequence of positive numbers. Show that $\sum\limits_p a_p$ converges if and only if $\sum\limits_{n=2}^{\infty}\frac{a_n}{\log n}$ converges.

The way I was trying to go about the proof is using the integral convergence test and the Prime Number Theorem, by saying that $$\int_1^\infty a(p(x))dx = \int_2^\infty a(t)\pi'(t)dt$$ where $p(x)$ is an interpolated version of the n-th prime sequence, and $\pi(t)$ is the prime counting function. Then by the PNT, we know that $\pi(t) = \frac{t}{\log t} + O\left(\frac{t}{\log^2 t}\right)$. By a leap of logic, I'd hope that $\pi'(t) = \frac{1}{\log t} + o\left(\frac{1}{\log t}\right)$, which would make the last integral equal to $$\int_{2}^{\infty}\frac{a(t)}{\log t} dt + \text{terms of lower order}$$
This would then converge if and only if $\sum\limits_{n=2}^{\infty}\frac{a_n}{\log n}$ converges. The problem is that differentiating the Big-O estimate doesn't seem valid, and I am unable to come up with good enough estimates to prove this relationship (if it is even true).
 A: By partial summation we have $$ \sum_{1<n\leq N}\frac{a_{n}}{\log\left(n\right)}=\sum_{1<n\leq N}1\cdot\frac{a_{n}}{\log\left(n\right)}=\frac{\left(N-1\right)a_{N}}{\log\left(N\right)}+\sum_{k\leq N-1}\left(k-1\right)\left(\frac{a_{k}}{\log\left(k\right)}-\frac{a_{k+1}}{\log\left(k+1\right)}\right)$$ and $$\sum_{p\leq N}a_{p}=\pi\left(N\right)a_{N}+\sum_{k\leq N-1}\pi\left(k\right)\left(a_{k}-a_{k+1}\right)$$ which is, from PNT, $$\sim\frac{Na_{N}}{\log\left(N\right)}+\sum_{k\leq N-1}\frac{k}{\log\left(k\right)}\left(a_{k}-a_{k+1}\right)$$ now note that $$ \log\left(k+1\right)-\log\left(k\right)=\log\left(1+\frac{1}{k}\right)=o\left(1\right)$$ as $k\rightarrow\infty$, so the first series converges iff the second does.
A: Denote $a=\lim a_n$. If $a\ne 0$, then obviously both series diverge.
So let further $a=0$. Then $a_n=b_n+b_{n+1}+\ldots$, where $b_n=a_n-a_{n+1}\geqslant 0$. We have $$\sum_p a_p=\sum_p (b_p+b_{p+1}+\ldots)=\sum_n \pi(n) b_n.$$)
Next, $$\sum \frac{a_n}{\log n}=\sum_n \left(\sum_{k\leqslant n} \frac1{\log k}\right)b_n.$$
It remains to observe that $$\pi(n)\sim \frac{n}{\log n}\sim \sum_{k\leqslant n}\frac1{\log k}.$$
A: I just wanted to record another answer similar to the previous ones but with more explicit mention of the convergence tests used.
Using summation by parts, we have:
$$\sum\limits_{p \leq N}a_p = \sum\limits_{2 \leq n \leq N}\mathbb{1}_P(n)a_n = \sum\limits_{2 \leq n \leq N}\left[\pi(n) - \pi(n - 1)\right]a_n$$
$$ = a_N\pi(N) + \sum\limits_{2 \leq n \leq N-1}\pi(n)\left(a_n - a_{n+1}\right) \tag{1}$$
Using the Chebyshev bounds $c\frac{n}{\log n} \leq \pi(n) \leq C\frac{n}{\log n}$ for all $n \geq N_0$ where $c, C, N_0$ are positive constants, and the fact that $a_n$ is positive and nonincreasing, the comparison test shows that $a_N\pi(N)$ converges if and only if $a_N\frac{N}{\log N}$ converges and that the series with partial sums $\sum\limits_{2 \leq n \leq N-1}\pi(n)\left(a_n - a_{n+1}\right)$ converges if and only if the series with partial sums $\sum\limits_{2 \leq n \leq N - 1}\frac{n}{\log n}\left(a_n - a_{n+1}\right)$ converges.
Since $a_n$ is positive and nonincreasing, all terms in $(1)$ are nonnegative so $(1)$ converges if and only if the following converges: $$a_N\frac{N}{\log N} + \sum\limits_{2 \leq n \leq N-1}\frac{n}{\log n}\left(a_n - a_{n+1}\right)\tag{2}$$
Now we use summation by parts again:
$$a_N\frac{N}{\log N} - \sum\limits_{2 \leq n \leq N - 1}\frac{n}{\log n}(a_{n+1}-a_n)$$
$$ = a_N\frac{N}{\log N} - \left\{\frac{N-1}{\log (N-1)}a_N - \frac{2}{\log 2}a_2 - \sum\limits_{3 \leq n \leq N - 1}a_n\left[\frac{n}{\log n} - \frac{n - 1}{\log (n - 1)}\right]\right\}$$
$$ = \frac{2}{\log 2}a_2 + \sum\limits_{3 \leq n \leq N}a_n\left[\frac{n}{\log n} - \frac{n - 1}{\log (n-1)}\right]\tag{3}$$
We can check that the function $\frac{n}{\log n}$ is nondecreasing and that $$\frac{n}{\log n} - \frac{n - 1}{\log (n-1)} \sim \frac{1}{\log n}$$
The limit comparison test then implies that $(3)$ converges if and only if $\sum\limits_{2 \leq n \leq N}\frac{a_n}{\log n}$ converges.
