Do the series converge? Let $g \colon \mathbb{N} \rightarrow \{0,1\}$ such that $g(n)=0$, if $n \equiv 0$ or $n \equiv 1 ~(\bmod~4)$; or  $g(n)=1$, if $n \equiv 2$ ou $n \equiv 3 ~(\bmod~4)$.
Do $\sum_{n=1}^\infty \frac{(-1)^{g(n)}}{\sqrt{n}}$ converge?
The series is something like this

*

*If $n=1$, then $\frac{(-1)^{g(n)}}{\sqrt{n}} = \frac{(-1)^{0}}{\sqrt{1}} = 1$, partial sum of 1


*If $n=2$, then  $\frac{(-1)^{g(n)}}{\sqrt{n}} = \frac{(-1)^{1}}{\sqrt{2}} \approx -0.707$, partial sum of  $\approx$ 0.293


*If $n=3$, then $\frac{(-1)^{g(n)}}{\sqrt{n}} = \frac{(-1)^{1}}{\sqrt{3}} \approx -0.577$, partial sum of  $\approx$ -0.284


*If $n=4$, then $\frac{(-1)^{g(n)}}{\sqrt{n}} = \frac{(-1)^{0}}{\sqrt{4}} = 0.5$, partial sum of $\approx$ 0.216


*$\cdot\cdot\cdot$ and goes on
What I thought of doing?

*

*Break the series (call it $a_n$) into two ($b_n$ and $c_n$), where $b_n$ is the positive terms and make the negative terms = $0$; and $c_n$ is only the negative terms, and the terms which are indices of positive = $0$. So we have an equality of $a_n = b_n - c_n$. If I show that either $b_n$ or $c_n$ diverges then $a_n$ diverges?

*I know, by using Alternate Series Test, that $\sum _{n=1}^{\infty }\frac{(-1)^n}{\sqrt{n}}$ converges, but does this also means $\sum_{n=1}^\infty \frac{(-1)^{g(n)}}{\sqrt{n}}$ converges? It is not properly a reordering, so I have my doubts.

I am not sure of any of the ways, so thats why I am here. Thank you.
 A: I think that's
$$\sum_{m=0}^\infty\left(\frac1{\sqrt{4m+1}}-\frac1{\sqrt{4m+2}}
-\frac1{\sqrt{4m+3}}+\frac1{\sqrt{4m+4}}\right).$$
The mean value theorem implies that both
$$\frac1{\sqrt{4m+1}}-\frac1{\sqrt{4m+2}}$$
and
$$-\frac1{\sqrt{4m+3}}+\frac1{\sqrt{4m+4}}$$
are $O(m^{-3/2})$, and so this series converges by comparison with
$\sum_{m=1}^\infty m^{-3/2}$
.
A: The series converges by Dirichlet's test. In the notation of the Wikipedia article, let $a_n=\frac1{\sqrt n}$, and let $b_n=(-1)^{g(n)}$.  Then $\mid\sum_{k=1}^n b_k\mid\leq2$ and the test applies.
A: We have
$$\sum_{n=1}^\infty \frac{(-1)^{g(n)}}{\sqrt{n}}=\frac{1}{1}-\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{3}}+\frac{1}{\sqrt{4}}+\cdots$$
Now, note that for for $n\equiv 2\ (\text{mod}\ 4)$ we have the terms
$$\cdots-\frac{1}{\sqrt{n}}-\frac{1}{\sqrt{n+1}}+\frac{1}{\sqrt{n+2}}+\frac{1}{\sqrt{n+3}}-\cdots$$
$$\cdots-\frac{\sqrt{n}+\sqrt{n+1}}{\sqrt{n(n+1)}}+\frac{\sqrt{n+2}+\sqrt{n+3}}{\sqrt{(n+2)(n+3)}}$$
That is, the sum can be rewritten as
$$\sum_{n=1}^\infty \frac{(-1)^{g(n)}}{\sqrt{n}}=1+\sum_{n=1}^\infty (-1)^n\frac{\sqrt{2n}+\sqrt{2n+1}}{\sqrt{2n(2n+1)}}$$
But we see that the term in this sum is decreasing. We conclude by the alternating series test that the sum converges

REQUESTED EDIT: Note that
$$0\leq \left(\frac{\sqrt{2n}+\sqrt{2n+1}}{\sqrt{2n(2n+1)}}\right)^2=\frac{4n+1+2\sqrt{2n(2n+1)}}{2n(2n+1)}$$
$$\leq\frac{5n+2\sqrt{2n(2n+1)}}{2n(2n+1)}=\frac{5}{4n+2}+\frac{2}{\sqrt{2n(2n+1)}}$$
$$<\frac{5}{4n}+\frac{2}{\sqrt{2n(2n-n)}}=\frac{5}{4n}+\frac{2}{n\sqrt{2}}$$
$$<\frac{2}{n}+\frac{2}{n}=\frac{4}{n}\to 0$$

SECOND REQUESTED EDIT: Note that
$$1=\frac{1}{1}$$
$$n=1:\ (-1)^1\frac{\sqrt{2\cdot 1}+\sqrt{2\cdot 1+1}}{\sqrt{2\cdot 1(2\cdot 1+1)}} =-\frac{\sqrt{2}+\sqrt{3}}{\sqrt{2}\sqrt{3}}=-\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{3}}$$
$$n=2:\ (-1)^2\frac{\sqrt{2\cdot 2}+\sqrt{2\cdot 2+1}}{\sqrt{2\cdot 2(2\cdot 2+1)}} =\frac{\sqrt{4}+\sqrt{5}}{\sqrt{4}\sqrt{5}}=\frac{1}{\sqrt{4}}+\frac{1}{\sqrt{5}}$$
$$n=3:\ (-1)^3\frac{\sqrt{2\cdot 3}+\sqrt{2\cdot 3+1}}{\sqrt{2\cdot 3(2\cdot 3+1)}} =-\frac{\sqrt{6}+\sqrt{7}}{\sqrt{6}\sqrt{7}}=-\frac{1}{\sqrt{6}}-\frac{1}{\sqrt{7}}$$
$$\vdots$$
The left hand side is the terms we found while the right hand side are the original terms.
A: For another proof of convergence, we can rewrite the sum with $a^{-1/2}=\pi^{-1/2}\int_0^\infty x^{-1/2}e^{-ax}dx$ as$$\pi^{-1/2}\sum_{m\ge0}\int_0^\infty x^{-1/2}e^{-(4m+1)x}(1-e^{-x})(1-e^{-2x})dx=\pi^{-1/2}\int_0^\infty\frac{x^{-1/2}e^{-x}(1-e^{-x})}{1+e^{-2x}}dx.$$For small $x>0$, the integrand $\sim\tfrac12x^{1/2}$; for large $x$, the integrand $\sim x^{-1/2}e^{-x}$.
