$(m, m+2)$ is twin prime, iff $4((m-1)! + 1) \equiv -m \pmod {m(m+2)}$

The Wiki page on Twin Primes says

The pair $(m, m+2)$ is twin prime, iff $4((m-1)! + 1) \equiv -m \pmod {m(m+2)}$.

This is obviously connected to Wilson's Theorem. Can anybody provide a proof for that, along the lines of thought given here, Wilson's Theorem/Proofs/Prime modulus – another proof?

• Use Chinese Remainder theorem. If $m$ is odd, then the right condition is equivalent to two formulas: $4((m-1)!+1) \equiv 0 \pmod m$ and $4((m-1)!+1)\equiv -2 \pmod {m+2}$. The case where $m$ is even needs to be dealt with separately. – Thomas Andrews May 14 '12 at 19:43

By Wilson's Theorem, if $m$ is prime, then $(m-1)!+1\equiv 0\pmod{m}$, and therefore $$4[(m-1)!+1]+m \equiv 0\pmod{m}.\tag{1}$$
If $m+2$ is prime, then $(m+1)!+1\equiv 0\pmod{m+2}$, again by Wilson's Theorem. But since $m+1\equiv -1\pmod{m+2}$, and $m\equiv -2\pmod{m+2}$, we have $(m+1)!\equiv (-1)(-2)(m-1)!\equiv 2(m-1)!\pmod{m+2}$, and therefore $$4[(m-1)!+1]+m \equiv 2(m+1)!+2+m+2\equiv 0\pmod{m+2}.\tag{2}$$ Since $m$ is odd, the numbers $m$ and $m+2$ are relatively prime, and therefore by $(1)$ and $(2)$ we have $4[(m-1)!+1]+m\equiv 0\pmod{m(m+2)}$.
Hint  Both directions can be quickly and easily proved simultaeneously using Wilson's theorem:
$$\begin{eqnarray} \rm m\ prime &\iff&\rm\ mod\ m\!:\ &\rm\: 1+(m\!-\!1)! \equiv 0\iff 4(m\!-\!1)!+4\equiv 0\equiv -m \\[.2em] \rm m\!+\!2\ prime &\iff&\rm mod\ m\!+\!2\!:\ &\rm\: 1+(m\!+\!1)!\equiv 0\iff 4(m\!-\!1)!+4 \equiv 2\equiv -m\\[.2em] \rm & &\rm because &\rm \!\!\!\!2(1+\color{#c00}{(m\!+\!1)!})\:\ \equiv \:\ 2\: +\: 4\color{#c00}{(m\!-\!1)!} \\[.2em] & &\rm because &\rm\qquad\! \color{#c00}{(m\!+\!1)!} = \underbrace{(m\!+\!1)m}_{\large\equiv\ -1\,(-2) }(m\!-\!1)!\equiv \color{#c00}{2(m\!-\!1)!}\\ \end{eqnarray}$$