I try to use the for loop to solve this question, but it does not work. And here is what I did.
For(p = 2,p<=10000,(p-1)! = -1 mod (p^2),Print(p))
I am not sure how to describe "(p−1)!≡−1 mod p^2" in Mathematica. Could you give me some suggestions? Thank you.