Does $n=n^2 - (n!\;\bmod n^2)\implies\text{isPrime}(n) = \text{True}$?

36 Views Asked by At

With integers $n$, of such form that

$$n=n^2 - (n!\mod n^2)$$

Is $n$ always a prime number?

2

There are 2 best solutions below

0
On

Hint: If $n$ is not prime, then $n!\equiv 0\operatorname{mod}n^2$.

0
On

Yes.

If $n > 4$ is composite, then $n! \equiv 0 \bmod n^2$. For $n=4$ the claim does not hold.