prove that $n$ is prime or $n=4$ when $n|4((n−1)!+1)$ Let $n \gt 1$ be an integer such that :
$n|4((n-1)!+1)$
Prove that
$n=4$ or $n$ is prime
Since $4((n-1)!+1)$ has an explicit factor of $4$, plainly $2,4$ divide it, noting that $2$ is a prime. If $n\ne 2,4$ then $n|4((n-1)!+1)$ is true when $n|((n-1)!+1)$. Another way of saying that is $((n-1)!+1) \equiv 0 \bmod n$
If $n$ is prime, Wilson's theorem tells us that $(n-1)! \equiv -1 \bmod n$, which would imply the desired result $((n-1)!+1) \equiv 0 \bmod n$
It remains to be shown that if $n$ is not prime, the proposition fails. If $n&gt;4$ is not prime, it is factorable: $n=ab$ where $2\le a,b \le \frac{n}{2}&lt;n-1$. Since both $a,b$ are factors that appear in the factorial product $(n-1)!$, it is the case that $n\mid(n-1)!$ hence $n\not \mid((n-1)!+1)$ and we are done.
Since $4((n-1)!+1)$ has an explicit factor of $4$, plainly $2,4$ divide it, noting that $2$ is a prime. If $n\ne 2,4$ then $n|4((n-1)!+1)$ is true when $n|((n-1)!+1)$. Another way of saying that is $((n-1)!+1) \equiv 0 \bmod n$
If $n$ is prime, Wilson's theorem tells us that $(n-1)! \equiv -1 \bmod n$, which would imply the desired result $((n-1)!+1) \equiv 0 \bmod n$
It remains to be shown that if $n$ is not prime, the proposition fails. If $n&gt;4$ is not prime, it is factorable: $n=ab$ where $2\le a,b \le \frac{n}{2}&lt;n-1$. Since both $a,b$ are factors that appear in the factorial product $(n-1)!$, it is the case that $n\mid(n-1)!$ hence $n\not \mid((n-1)!+1)$ and we are done.