Thanks, Dickfore, that was of interest, even if most of it was over my head.
However, if I understand correctly...Euler's theorem is about the relationship between coprimes. I'm researching numbers that are not coprime, for example 7! and 72, where the gcd is 7, not 1.
To take another example, can I say with certainty that 66797! is congruent to 66797*66796 mod 667972 without having to calculate 66797!?
I've noticed that the pattern holds at least up to 13, i.e.
2! = 2 mod 4
3! = 6 mod 9
5! = 20 mod 25
7! = 42 mod 49
11! = 110 mod 121
13! = 156 mod 169
My question is: ...and so on? And a follow-up: if so, why?