TITLE: Proving that $\frac{\pi}{2}=\prod_{k=2}^{\infty}\left(1+\frac{(-1)^{(p_{k}-1)/2}}{p_{k}} \right )^{-1}$ an identity of Euler's.
QUESTION [14 upvotes]: This is another identity of Euler's relating $\pi$ to the prime numbers, available here
\begin{align*}
\dfrac{\pi}{2}=\prod_{k=2}^{\infty}\left(1+\dfrac{(-1)^{\dfrac{p_{{k}}-1}{2}}}{p_{k}} \right )^{-1}
\end{align*}
How does one prove this?

REPLY [14 votes]: Decompose the product on the right as
$$\prod_{\text{primes}\; p\\ \text{ of  the  form }4k+1}\left(1+\frac{1}{p}\right)\prod_{\text{primes}\; p\\ \text{ of  the  form }4k+3}\left(1-\frac{1}{p}\right)$$
Consider an odd integer $n=2m+1$. It is "easy to see" that if primes of the form $4k+3$ appear in its prime number decomposition an even number of times, then $n$ is of the form $4K+1$ [since $(4k_1+3)(4k_2+3)=1\; \mathrm{mod}\;4$]. If the number of such appearances is odd, then $n$ is of the form $4K+3$.
Rewrite the right side as
$$ \left[\prod_{\mathrm{odd}\;\mathrm{primes}\; p}\left(1-\frac{1}{p^2}\right)\right]^{-1}\times\frac{1}{\left[\prod_{p\\ \text{ of  the  form }4k+1}\left(1-\frac{1}{p}\right)\prod_{p\\ \text{ of  the  form }4k+3}\left(1+\frac{1}{p}\right)\right]^{-1}}\qquad\tag{1}$$
Expanding the first factor into geometric series, we find
$$ A=\left[\prod_{\mathrm{odd}\;\mathrm{primes}\; p}\left(1-\frac{1}{p^2}\right)\right]^{-1}=\sum_{m=0}^{\infty}\frac{1}{(2m+1)^2}=\frac{\pi^2}{8}$$
Similarly reexpanding the denominator of the 2nd factor in (1), we have
$$ B=\left[\prod_{p\\ \text{ of  the  form }4k+1}\left(1-\frac{1}{p}\right)\prod_{p\\ \text{ of  the  form }4k+3}\left(1+\frac{1}{p}\right)\right]^{-1}=\sum_{m=0}^{\infty}\frac{(-1)^{r(m)}}{2m+1},$$
where $r(m)$ counts the number of appearances of primes of the form $4k+3$ in the decomposition of $2m+1$. But then Step 2 allows to write $(-1)^{r(m)}=(-1)^m$, so that 
$$ B=\sum_{m=0}^{\infty}\frac{(-1)^{m}}{2m+1}=\frac{\pi}{4}$$
and $\displaystyle \frac{A}{B}=\frac{\pi^2/8}{\pi/4}=\frac{\pi}{2}$.   $\blacksquare$