How do I solve for M modulo 2021 where M is the product of all numbers relatively prime to 2021 that are less than 2021. I know Wilson's Theorem but that's applicable for modulo p where p is prime. Should I use CRT by breaking 2021 into 43 and 47 but even that seems intractable to me. Any help is appreciated.
All of these numbers will have multiplicative inverses (mod 2021), so they all cancel, with the exception of those numbers which are their own inverses. So $M$ is the product of the residues whose square is $1$.
We can find all such $x$ using the CRT to be $1, 988, 1033, 2020$. So their product $M = 1$.