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).

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.
