For which $n$ do the numbers $1!, 2!, \ldots, n!$ give pairwise distinct remainders when divided by $n$?
Solution. If $n=1,2$ or 3, it can be easily verified that they give different remainders when divided by $n$. If $n=4$, then $2!=2$ and $3!=6$ give the same remainder when divided by 4, so $n=4$ does not satisfy the condition. We will show that if $4<n$, and therefore $2 n=p(2 p) \mid(n-1)$ !, then $n \mid(n-1)$ ! also holds. Thus, $(n-1)$ ! and $n$ ! both give a remainder of 0 when divided by $n$, meaning that composite numbers greater than 4 do not satisfy the condition. Finally, if $n>3$ is a prime number, then by Wilson's theorem, $(n-1)!\equiv-1(n)$, and therefore $(n-2)!\equiv 1(n)$, since $(n-1)!=(n-1)(n-2)!\equiv-(n-2)!(n)$. Thus, $(n-2)$ ! and 1 ! give the same remainder when divided by $n$, so prime numbers greater than 3 are also not suitable. Therefore, the value of $n$ can be 1, 2, or 3.