Prove that $n$ and $n + k$ are both primes if and only if $(k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv 0 \mod n(n + k)$.

152 Views Asked by At

Prove that positive integers $n$ and $n + k$, where $n > k$ and $2 \mid k$, are both primes iff $$(k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv 0 \mod n(n + k)$$

According to Wilson's theorem, we have that for all primes $n$, $$(n - 1)! + 1 \equiv 0 \mod n$$

$$\iff (k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv 0 \mod n \ (1)$$

Moreover, $n \equiv -k \mod n + k$

$$\iff n(k! - 1)(k - 1)! \equiv -k(k! - 1)(k - 1)! \equiv -k!(k! - 1) \mod n + k$$

$$\iff (k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv (k!)^2[(n - 1)! + 1] - k!(k! - 1)$$

$$\equiv (k!)^2(n - 1)! + k! \mod n + k$$

And this is where I'm stuck.

I have an idea that according to Wilson's theorem, we have that for all primes $n + k$, $$(n + k - 1)! + 1 \equiv 0 \mod n + k$$

$$\iff (k!)^2(n - 1)! + k! \equiv (k!)[k!(n - 1)! + 1]$$

$$\equiv (k!)[k!(n - 1)! - (n + k - 1)!] \equiv (k!)^2\left[(n - 1)! - \prod_{i = 1}^{n - 1}(k + i)\right]$$

It needs to be proven that $$(n - 1)! \equiv \prod_{i = 1}^{n - 1}(k + i) \mod n + k$$, which is true since $n - j \equiv -(k + j) \mod n + k, j = \overline{1, n - 1}$

$$\implies \prod_{j = 1}^{n - 1}(n - j) \equiv (-1)^{n - 1}\prod_{j = 1}^{n - 1}(k + j) \mod n + k,$$ moreover, $n$ is a prime larger than $2 \implies 2 \not\mid n \iff 2 \mid (n - 1)$

$$\implies (n - 1)! \equiv \prod_{i = 1}^{n - 1}(k + i) \mod n + k$$

1

There are 1 best solutions below

1
On BEST ANSWER

The converse is not true.

Note first that if $n | k!$ then

$$(k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv 0 \mod n$$

Same way, if $n+k | (k-1)!$ you have $$(k!)^2[(n - 1)! + 1] + n(k! - 1)(k - 1)! \equiv 0 \mod (n + k)$$

Moreover, if $gcd(n,k)=1$ then $n$ and $n+k$ are relatively prime.

Now, it is easy to see that for example $n=33$ and $k=32$ satisfies these three conditions, and hence are a counter example.