Divergence for $p$ prime numbers and convergence for $m$ composite numbers
Does there exist a sequence $(a_n)_{n\in \mathbb N} \in \mathbb C^{\mathbb N}$ such that :
For all $p$ prime numbers the series $\displaystyle \sum_{n\in \mathbb{N}} a_n^p$ diverges, and for all composite $m>0$ the serie $\displaystyle \sum_{n\in \mathbb N} a_n^m$ converges ?
My guess :
I know there exist a serie $\displaystyle\sum \frac{\cos(\frac{2}{3}\pi n)}{\ln(1+n)}$ converge but $$ \displaystyle\sum \left(\frac{\cos(\frac{2}{3}\pi n)}{\ln (1+n)}\right)^3 $$ diverges so I think that the answer is yes.
And I have seen that there exist a convergent serie $\displaystyle\sum a_n$ such that $$ \displaystyle\sum a_n^\alpha, \quad \alpha\in \mathbb{N}, \alpha>1 $$ diverges.
Proof.
For exemple $$ a_{3k}=\frac{2}{\ln(k)}, \quad a_{3k-1}=a_{3k+1}=-\frac{1}{\ln(k)}(k=2,3,\cdots). $$
This is problem 5 from day 1 of the 2013 IMC. See here for one solution, and the official solution.
For real sequences, this is impossible. If the series converges for any even exponent $m$, then $a_n\rightarrow 0$ as $n\rightarrow\infty$, and hence $|a_n|^{m'} < |a_n|^{m}$ for sufficiently large $n$ and any $m'>m$. Therefore, if the series converges for any even exponent, it is absolutely convergent for all larger exponents. (In particular, if it converges for $m=4$, then it must converge for all primes $p\ge 5$.)