Show $\sum \frac{1}{p}(-1)^{(p-1)/2}$ converges

Show that the sum $$\sum \frac{(-1)^{\frac{p-1}{2}}}{p}$$ converges, where the sum is taken over all odd primes.

This problem was on an old Harvard qualifying exam. Is there a reasonably elementary way to solve it?


We have that $\left(p-1\right)/2$ is odd iff $p\equiv3\textrm{ mod }4$ and is even iff $p\equiv1\textrm{ mod }4$. Let $$A\left(N\right)=\sum_{p\leq N}\left(-1\right)^{\left(p-1\right)/2}=\left|\left\{ p\leq N:\, p\equiv1\textrm{ mod }4\right\} \right|-\left|\left\{ p\leq N:\, p\equiv3\textrm{ mod }4\right\} \right|=\pi\left(N;4,1\right)-\pi\left(N;4,3\right).$$ By partial summation $$\sum_{p\leq N}\frac{\left(-1\right)^{\left(p-1\right)/2}}{p}=\frac{A\left(N\right)}{N}+\int_{3}^{N}\frac{A\left(t\right)}{t^{2}}dt$$ then observe that, by prime number theorem on arithmetic progression (using the fact that $4<\left(\log\left(N\right)\right)^{C}$ for some $C>0$) $$\pi\left(N;4,1\right)-\pi\left(N;4,3\right)=O\left(\frac{N}{\phi(4)\log\left(N\right)^{2}}\right)$$ where $\phi(.)$ is the Euler totient function, so $$\sum_{p\leq N}\frac{\left(-1\right)^{\left(p-1\right)/2}}{p}=O\left(\frac{1}{\log\left(N\right)^{2}}+\int_{3}^{N}\frac{1}{t\log\left(t\right)^{2}}dt\right)=O\left(\frac{1}{\log\left(N\right)^{2}}+\frac{1}{\log\left(N\right)}+ \frac{1}{\log(3)}\right)=O\left(1\right).$$ Now take $N\longrightarrow\infty.$