I will deal with the case $|A| = \infty$ with a lot of inspiration from Robert Israel's answer.
The idea of the proof is from the mechanic used by the Cantor’s diagonal extraction process.
Take $A= \{n_1 < n_2 < \dots\}$ an infinite set of odd natural numbers, we will construct with a procedure inspired by cantor's diagonal extraction process, a suitable sequence $\left(a_n\right)_{n \in \mathbb{N}}$ such that
$$\sum a_n^k \, \text{ converges} \iff k \in A$$
But this time we will modify it just a bit (or maybe more than I thought when I began writing this).
First step
Let $m \geq 1$, we define $A_m = \{n_1,\dots,n_m\}$ and the polynomial
$$g_m(X) = \left(\prod_{j=1}^m (X-2^{n_j}) \right)^2 = \epsilon_{2m}d_{2m}X^{2m} + \epsilon_{2m-1}d_{m-1}X^{m-1} + \cdots + \epsilon_1 d_1 X+ \epsilon_0 d_0$$
with $\epsilon_i \in \{-1,1\}$ and $d_i \in \mathbb{N}$.
We then define
$$f_m(x) = g_m(2^x) = \left( \prod_{j=1}^m (2^x-2^{n_j}) \right)^2$$
and
$$\forall 0\le i \le 2m, \quad \forall 1\le j \le d_i, \qquad b_{D_i + j} = \epsilon_i 2^i \qquad \text{where} \, D_i = \sum_{l =0}^{i-1} d_l.$$
A few remarks:
- $\epsilon_{2m}=1$, $d_{2m}=1$, $\epsilon_0 = (-1)^m$ and $d_0 = 2^{n_1 + \cdots + n_m}$.
- I have squared the function Robert uses for positivity since the size of my paquets changes (it may not be necessary but I did not want to make things more complicated than they already are).
- $r_m = D_{2m+1}$.
Just as in Robert's solution. Now we make some observations:
- $f_m(k) = 0 \iff k \in A_m$.
- $f_m(k) \in \mathbb{N}$.
- $f_m(k) = b_{m,1}^k + \cdots + b_{m,r_m}^k$ for odd $k$.
Second step: construction of the sequence.
Since the summation by paquets will be more tricky than usual, we need to define not $1$ but $4$ sequences for more coherence: $s_n$, $c_n$, $R_n$ and $a_n$. We could do it "by hand" but since it begins to be very tricky, let us do it right!
- Initialisation:
$$\begin{align*}
s_1 &= 2\\
c_1 &= 1\\
R_1 &= 0\\
a_j &= \frac{b_{1,j}}{\log 2} & \text{for} \quad 1\le j \le r_1
\end{align*}$$
- If $\dfrac{\sum_j |b_{(c_{n-1}+1),j}|^{n_{(c_{n-1}+1)}}}{\log (s_{n-1}+1)} \le \frac{1}{n}$
$$\begin{align*}
s_n &= s_{n-1} + 1 \\
c_n &=c_{n-1}+1\\
R_n &= R_{n-1} + r_{c_{n-1}}\\
a_{R_n+j} &= \frac{b_{c_n,j}}{\log s_n} & \text{for} \quad 1\le j \le r_{c_n}
\end{align*}$$
- If $\dfrac{\sum_j |b_{(c_{n-1}+1),j}|^{n_{(c_{n-1}+1)}}}{\log (s_{n-1}+1)} > \frac{1}{n}$
$$\begin{align*}
s_n &= s_{n-1} + 1 \\
c_n &=c_{n-1}\\
R_n &= R_{n-1} + r_{c_{n-1}}\\
a_{R_n+j} &= \frac{b_{c_n,j}}{\log s_n} & \text{for} \quad 1\le j \le r_{c_n}
\end{align*}$$
The intuition behind this, is that I need to ensure that the divisor is big enough compared to the paquet to converge to $0$ otherwise we don't have convergence for $k \in A$ since the paquet will be too big. In this spirit we have:
- $s_n$ that knows the number of the paquet we are in.
- $c_n$ that knows the index $m$ of $A_m$ the paquet recognizes and ensure that the divisor is big enough for the sum of his paquet to absolutely converge to $0$.
One can say that if $c_n = m$, all the $k \in A$ smaller or equal to $n_m$ (so the $m$ first) are dealt with.
- $R_n$ that just counts the beginning index of each paquet: the $n$-th paquet is $\{R_n +1, R_n + 2, \dots, R_{n+1}\}$.
Last step: proof of convergence (and divergence).
Now if we take $N = R_p + q $ big enough for the considerations we need further with $1 \le q \le r_{c_p}$ (so $N$ in the $p^\text{th}$ paquet).
$$\begin{align*}
\sum_{n=1}^N a_n^k
&= \sum_{t=1}^{p-1} \sum_{j=1}^{r_{c_t}} a_{R_t +j }^k
+ \sum_{j=1}^q a_{R_p + j}^k\\
&= \sum_{t=1}^{p-1} \sum_{j=1}^{r_{c_t}} \left( \dfrac{b_{c_t,j}}{\log s_t} \right)^k
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
\end{align*}$$
Case 1: $k$ is odd.
$$\begin{align*}
\sum_{n=1}^N a_n^k
&= \sum_{t=1}^{p-1} \sum_{j=1}^{r_{c_t}} \left( \dfrac{b_{c_t,j}}{\log s_t} \right)^k
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&= \sum_{t=1}^{p-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
\end{align*}$$
Case 1.1: $k \in A$
There exists $m \in \mathbb{N}$ such that $n_m = k$, thus for $m' \ge m, \, f_{m'} (k) = 0$.
We take $T$ such that $c_T = m$:
Note that it exists since $c_n$ is non-decreasing and non-stationary, thus it diverges to $\infty$.
We define $\alpha(t)$ as the unique integer verifying
$$c_{\alpha(t)} = c_t$$
And
$$c_{\alpha(t)} = c_{\alpha(t)-1} +1$$
it is easy to verify that it is increasing and non stationary thus it diverges to $\infty$.
$$\begin{align*}
\sum_{n=1}^N a_n^k
&= \sum_{t=1}^{p-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&= \sum_{t=1}^{T-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{t=T}^{p-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&= \sum_{t=1}^{T-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ 0
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&= \sum_{t=1}^{T-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k
\end{align*}$$
But the first term is a constant, so we only need to study the second (recall that $|b_{c_p,j}|\ge 1$ so $|b_{c_p,j}|^k\le |b_{c_p,j}|^{n_{c_p}}$:
$$\begin{align*}
\left|
\sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k
\right|
&\le \sum_{j=1}^q \dfrac{|b_{c_p,j}|^k}{\log (s_p)^k} \\
&\le \sum_{j=1}^{r_{c_p}} \dfrac{|b_{c_p,j}|^{n_{c_p}}}{\log( s_p)} \\
&\le \sum_{j=1}^{r_{c_{\alpha(p)}}} \dfrac{ |b_{c_{\alpha(p)},j}|^{n_{c_{\alpha(p)} } } }{\log( s_{\alpha(p)})} \\
&\le \dfrac{1}{\alpha(p)} \to 0
\end{align*}$$
We have $\log (s_p)^k \ge \log s_p$ since we supposed $N$ big enough.
Which means $\sum a_n^k$ converges!
Case 1.2: $k \notin A$.
We have from the previous observation $f_m(k)\ge 1$ for all $m \in \mathbb{N}$. This gives us
$$\begin{align*}
\sum_{n=1}^N a_n^k
&= \sum_{t=1}^{p-1} \dfrac{f_{c_t}(k)}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&\ge \sum_{t=1}^{p-1} \dfrac{1}{\log (s_t)^k}
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&\ge \sum_{t=1}^{p-1} \dfrac{1}{\log (s_t)^k}
- \left|\sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \right|\\
&\ge \sum_{t=1}^{p-1} \dfrac{1}{\log (s_t)^k}
- \dfrac{1}{\alpha(p)} \to \infty\\
\end{align*}$$
Which means $\sum a_n^k$ diverges.
Case 2: $k$ is even.
$$\begin{align*}
\sum_{n=1}^N a_n^k
&= \sum_{t=1}^{p-1} \sum_{j=1}^{r_{c_t}} \left( \dfrac{b_{c_t,j}}{\log s_t} \right)^k
+ \sum_{j=1}^q \left( \dfrac{b_{c_p,j}}{\log s_p} \right)^k \\
&\ge \sum_{t=1}^{p-1} \sum_{j=1}^{r_{c_t}} \dfrac{1}{\log (s_t)^k} \\
&\ge \sum_{t=1}^{p-1} \dfrac{r_{c_t}}{\log (s_t)^k} \\
&\ge \sum_{t=1}^{p-1} \dfrac{1}{\log (s_t)^k} \to \infty\\
\end{align*}$$
Which means $\sum a_n^k$ diverges.
Conclusion:
As wished,
$$\sum a_n^k \, \text{converges} \iff k \in A.$$
In summary, as counterintuitive as in can be, for any subset $A \subset 2 \mathbb{N} +1$ (it can even be empty of course) there exists an explicit (so no need of the AoC) real sequence $(a_n)$ such that $\sum a_n^k$ converges iff $k \in A$.