I thought that this question is more suitable for MSE, and asked it there. (Link to the MSE question) However, it does not get any answer despite the upvotes. It appears that I might have underestimated its difficulty. Please tell me if it is suitable for MO; ask me to delete it if it is inappropriate.
Let $S\subseteq \mathbb Z^+$ be a set of positive odd numbers. I am asked to prove that there exists a sequence $(x_n)$ such that for any positive integer $k$, $$ \sum_{n=1}^\infty x_n^k $$ converges if $k\in S$ and diverges if $k\notin S$.
I have no idea where to start. In the special case $S=\{1\}$, we can let the sequence $(x_n)$ be $$ y_1,y_1,-2y^1,y_2,y_2,-2y_2,\ldots, $$ where $y_n\to 0$ but $y_n$ decreases very slowly. However I doubt if this would work for more complicated $S$. Note that $S$ can be infinite.
Any hints?