TITLE: Sum f(p) over all primes convergent with sum f(n) over all natural numbers divergent?
QUESTION [9 upvotes]: The sum $\sum_{n=1}^{\infty} 1/n^{s}$ is convergent for all real $s>1$ and diverges for all real $s \le 1$. The same holds for the sum $\sum_{p \ prime} 1/p^{s}$. Thus, for the functions $f(n)= 1/n^s, s \in \mathbb{R}$ the sum $\sum_{n=1}^{\infty}f(n)$ shows the same convergence behaviour as the sum $\sum_{p \ prime}f(p)$.
The same holds, if I'm not mistaken, for the functions $f(n)= 1/(n (\ln n)^s),  s \in \mathbb{R}$ (both for $n \in \mathbb{N}$ and for primes convergence iff $s>1$). 
Question: Is there a real monotonic function $f$ such that $\sum_{n=1}^{\infty}f(n)$ diverges whereas sum $\sum_{p \ prime}f(p)$ converges? (The monotony requirement is for preventing 'artificial' solutions that single out the primes (as e.g. $f(n) = 2^n$ if $n$ is prime; $f(n)=n$ if $n$ is not prime)).

REPLY [5 votes]: Note also that if $\{a_n\}$ is an increasing sequence of natural numbers that presents arbitrarily large gaps between consecutive terms (e.g. a sequence with with density $0$),  there is always a positive decreasing function $f$ such that the sum of $f(a_n)$ converges and the sum of $f(n)$ diverges to positive infinity. The reason is that $\sum_n f(n)\geq\sum_n f(a_n)(a_n-a_{n-1}),$ and as the $a_n-a_{n-1}$ are unbounded, the claim reduces to the easy: for any unbounded sequence $u_n>0$ there is a convergent series with coefficients $\epsilon_n>0$ such that the series of the $u_n\epsilon_n$ diverges. Use this taking $u_n:=a_n-a_{n-1}$ to define a decreasing $f$ such that $f(a_n)=\epsilon_n$. 
(Just to clarify that if your question was really "is there a function" and not "which function", then it has a basic answer, not requiring the prime number theorem).