<s>[INST] Error in my approach to prove that $(m-1)^{m-1} \equiv m - 1 \pmod m$ using a concrete example I read somewhere that if $m$ is composite then $(m - 1)^{m - 1} \equiv m - 1 \pmod m$ and I was curious to try to prove it myself.
So I took as $m = 6$.
Now I can see that $5^5 \equiv 5 \pmod 6$
I was thinking along the following lines:
Since $\gcd(6,5) = 1$ this means that if we multiply $5$ with all the numbers from $1$ to $5$ we have to get all the numbers in different order.
I.e.
The numbers less than $6$: $1,2,3,4,5$.
Multiply the above by $5$: $5,4,3,2,1$ i.e. we get the same set of numbers but in different order.
Since: $1\cdot 2\cdot 3\cdot 4\cdot 5 = 5\cdot 4\cdot 3\cdot 2\cdot 1$ we also have:
$1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv (1\cdot 5) \cdot (2\cdot 5) \cdot (3\cdot 5) \cdot (4\cdot 5) \cdot (5\cdot 5) \Leftrightarrow  1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv 5^5 (1\cdot 2\cdot 3\cdot 4\cdot 5) \Leftrightarrow 1 \equiv 5^5$
Which is actually wrong.
What is the problem in my approach and thought process?
 [/INST] your statement $$1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv (1\cdot 5) \cdot (2\cdot 5) \cdot (3\cdot 5) \cdot (4\cdot 5) \cdot (5\cdot 5) \Leftrightarrow  1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv 5^5 (1\cdot 2\cdot 3\cdot 4\cdot 5) \Leftrightarrow 1 \equiv 5^5$$
is not corrrect .
Note that $$1.2.3.4.5\equiv 0 \pmod 6 $$
</s>