3

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?

Bill Dubuque
  • 272,048
draks ...
  • 18,449
  • 6
    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

2 Answers2

7

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.

André Nicolas
  • 507,029
3

Follows immediately (mechanically!) by W = Wilson's theorem and (Easy) CRT as below,
using $\!\bmod m\!+\!2\!:\ \color{#0a0}{(m\!+\!1)!^{\phantom{|^{|^|}}}}\!\!\! = \smash{\underbrace{(m\!+\!1)m}_{\large \ \ (-1)(-2)}(m\!-\!1)!\equiv \color{#0a0}{2(m\!-\!1)!}}\,\ $ [Wilson reflection], $ $i.e.

$\begin{align} m\!+\!2\ {\rm prime} &\smash{\overset{\small \rm W\!}\iff} \overbrace{\color{#0a0}{(m\!+\!1)!}}^{\large\color{#0a0}{2(m-1)!}}\equiv -1\!\!\!\pmod{\!m\!+\!2}\smash{\overset{\color{#0a0}{\times\ 2}}\iff} \color{#0af}{4(m\!-\!1)!}\equiv -2\!\!\!\pmod{\!m\!+\!2}\\[.6em] m\ {\rm prime} &\smash{\overset{\small \rm W\!}\iff} (m\!-\!1)!\equiv -1\!\!\!\pmod{\!m}\ \ \ \smash{\overset{\times\ 4}\iff}\ \ \underbrace{\color{#0af}{4(m\!-\!1)!}\equiv -4\!\!\!\pmod{\!m}\phantom{M}} \end{align}$

$$\overset{\small \rm CRT}\iff\, \color{#0af}{4(m\!-\!1)!}\equiv -4 + m\underbrace{\left[\dfrac{2}{\color{#c00}m}\bmod m\!+\!2\right]}_{\large \color{#c00}m\ \equiv\ -2}\equiv\,\bbox[5px,border:1px solid #c00]{-4\!-\!m}\,\ \pmod{\!m(m\!+\!2)}$$

This method generalizes to prime $k$-tuples.

Bill Dubuque
  • 272,048
  • Please strive not to reply to "Problem Statement Questions" (PSQs). – nonuser May 21 '21 at 22:24
  • @Aqua The Q&A were posted a decade ago - when the site was a very different beast (in "population" mode, and policies and politics differed radically from nowadays). – Bill Dubuque May 21 '21 at 22:35