3

I have researched Wilson's theorem several times over stack exchange. I would only like to prove one direction. This seems to be a good explanation: Prove that $(n-1)! \equiv -1 \pmod{n}$ iff $n$ is prime

However, on their explanation, the author states that $k|(n-1)!$ implies that $k$ is congruent to $1$(mod $n$). I don't see their jump in logic. I am looking for either an explanation or a reference to a theorem if possible. Any assistance is appreciated. Thank you

3 Answers3

3

This isn't true in general. For example, $2 | (3-1)! = 2$ but $2$ is not congruent to $1 \pmod 3$. What the author on the question you referenced said was that from the conditions in Wilson's Theorem, $k | (n-1)!$ and also $k$ is congruent to $1 \pmod n$, not that $k | (n-1)!$ implies $k$ is congruent to $1 \pmod n$.

pancini
  • 19,216
  • It is not clear (to me at least) that the conditions in Wilson's Theorem imply that $k \equiv 1 \pmod n$. – Dylan Nov 24 '15 at 01:44
  • (Other than, of course, that the conditions imply that $k=1$) – Dylan Nov 24 '15 at 01:57
  • If n is composite, k < n implies that k | (n-1)! . Since n is assumed to satisfy Wilson's theorem, (n-1)! = -1 (mod n) and therefore k | -1 (mod n). However, the only number (mod n) that divides -1 (mod n) and 0 (mod n) is 1 (mod n). – arbitrary username Nov 24 '15 at 02:16
  • But wouldn't any number that is relatively prime to $n$ will divide a number congruent to $-1$ modulo $n$, and some other number congruent to $0$ modulo $n$? – Dylan Nov 24 '15 at 02:34
  • Yes, you are right. What I meant to say instead of k | 0 (mod n) was that k | n, which are two nonequivalent things. – arbitrary username Nov 24 '15 at 03:35
2

I am not sure how the answer in the linked post derives that $$ k \equiv 1 \pmod n $$

Instead, here as an alternative way to complete the proof. As in the linked answer, we assume that we have an integer $k$ such that $k<n$ and $k \mid n$. We know that $$ (n-1)! \equiv -1 \pmod n$$ and so since $k \mid n$ $$ (n-1)! \equiv -1 \pmod k$$

Since $k < n$, we have that $$ (n-1)! \equiv 0 \pmod k $$ (provided of course that $n>1$)

This gives us that $$ 0 \equiv -1 \pmod k$$ and so $k \mid 1$ as claimed in the linked answer.

Dylan
  • 7,416
  • Thank you for your answer. Could you please further explain the logic behind step 3; where you say since k < n, it is congruent to 0(mod k)? – Eswar Vinnakota Nov 26 '15 at 16:32
  • @EswarVinnakota $(n-1)!$ is equal to $1\cdot 2\cdot 3\cdots (n-1)$. Since $k<n$, one of the things which we are multiplying by to get $(n-1)!$ is $k$, So $(n-1)!$ is divisible by $k$. But this is the same thing as saying that $(n-1)! \equiv 0 \pmod k$. – Dylan Nov 26 '15 at 18:46
  • Sorry, one more clarification. What justification is used to establish that 0 is congruent to -1(modk)? Specifically, why do the two earlier conclusions add up to this one? – Eswar Vinnakota Nov 29 '15 at 04:25
  • We have that $0 \equiv (n-1)! \equiv -1 \pmod k$ from the previous two conclusions. We use that if $a \equiv b \pmod k$ and $b \equiv c \pmod k$ then $a \equiv c \pmod k$. – Dylan Nov 29 '15 at 09:39
0

As mentioned previously, the implication as you interpreted it is incorrect. $k\mid (n-1)!$ does not imply that $k\equiv 1\pmod{n}$. Take any counterexample you like, such as $k=3,n=5$.

Here I hope to go over some of the details of that section of the proof in the attempt to clarify some of the points.

Suppose that $(n-1)!\equiv -1\pmod{n}$

We argue that $n$ must be prime. To accomplish this, suppose to the contrary that $n$ is in fact composite. In this case, $n=km$ for some $k,m\in\mathbb{N}\setminus\{1\}$ implying that $k<n$.

In this case, $k$ must then be equal to one of $\{2,3,4,\dots,n-2,n-1\}$. This implies that $k\mid (n-1)!$ since $(n-1)!=\prod\limits_{i=1}^{n-1} i = k\prod\limits_{i=1~~~i\neq k}^{n-1} i$.

However, since $(n-1)!\equiv -1\pmod{n}$ and $k\mid n$ and $k\mid (n-1)!$, all of these things together imply that $k\equiv 1\pmod{n}$

Why? Since $k\mid n$ and $k\mid (n-1)!$, you have that $k\mid \gcd((n-1)!,n)$, but since $(n-1)!\equiv -1\pmod{n}$ that implies that $(n-1)!$ is coprime to $n$ (since this implies there is some multiple of $n$ which is exactly one away from $(n-1)!$). Therefore $\gcd((n-1)!,n)=1$ and so $k\mid 1$. This is, however, a contradiction since we said that $k\in\mathbb{N}\setminus \{1\}$.

JMoravitz
  • 79,518