Twin prime "test" via congruence

342 Views Asked by At

I decided to try getting a test for a "twinness" of a prime via Wilson's theorem.

Wilson's theorem says that integer $n > 1$ is a prime iff $$(n-1)! \ \equiv -1 \pmod n $$

Now, if both $n$ and $n+2$ are prime, we get two equations:

\begin{cases} (n-1)! \ \equiv -1 \pmod n & (1)\\ (n+1)! \ \equiv -1 \pmod{n+2} & (2) \\ \end{cases}

The equation (1) means that there exists integer $k$ such that $$(n-1)! = k n-1$$ By writing the equation (2) such that there is integer $v$ that $$(n+1) n (n-1)! = -1+ v(n+2)$$ and then replacing $(n-1)!$ in (2) from (1), we get: $$(n+1) n (k n-1) = -1+ v(n+2).$$

This can be written as $$k(n^3+n^2)+v(-2-n)=n^2+n-1 \ \ \ \ (3)$$

So, I would think that $n$ is the first of twin of primes iff there exists integers $k$ and $v$ that (3) is true.

But, take $n=7.$

Now we get $$392 k = 55 + 9 v$$ which has solution $\{k = 2, v = 81\}.$

This shouldn't be possible. Where is the error?

2

There are 2 best solutions below

1
On BEST ANSWER

Your logic is not reversible, so the congruence you derive is a necessary condition, not an if-and-only-if. For instance, there is no hope of deducing (1) from (3), because you have eliminated any information there was about $(n-1)!$ from (3).

0
On

Your equation $(3)$ had an arithmetic error, it should read:

$$k(n^3+n^2)-v(n+2)=n^2+n-1$$

Are you aware of the reformulation of Wilson's theorem for twin primes? The prime pages list it as follows:

$$4[(n-1)!+1]\equiv -n\mod n(n+2)$$