3
$\begingroup$

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?

  • 4
    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.2019-03-06

2 Answers 2

6

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)}$.

The proof of the converse follows similar lines, this time using the fact that the Wilson condition is sufficient for primality.

  • 0
    Very nice. Not along the lines I asked for, but (even better) I learnt something else. Thank you.2012-05-14
3

Hint $ $ Both directions can be quickly and easily proved simultaneously by 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 \ \ \ \ \ \ \ \ \ \ \ \ \, by &\rm \!\!\!\!2(1+\color{#c00}{(m\!+\!1)!})\:\ \equiv \:\ 2\: +\: 4\color{#c00}{(m\!-\!1)!} \\[.2em] & &\rm \ \ \ \ \ \ \ \ \ \ \ \ \, by &\rm\qquad\! \color{#c00}{(m\!+\!1)!} = \underbrace{(m\!+\!1)m}_{\large\equiv\ -1\,(-2) }(m\!-\!1)!\equiv \color{#c00}{2(m\!-\!1)!}\\ \end{eqnarray}$