Factorials of prime numbers? please help

Is there a name and/or proof for the following conjecture?

"For any prime p, p! is congruent to p2-p modulo p2."

Thanks much.
I think this might be of interest:

"[URL [Broken]
Last edited by a moderator:
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?


Staff Emeritus
Science Advisor
Gold Member
It might help to reduce the problem

p!=p2-p (mod p2) means that p2 divides (p!-p2+p)=p((p-1)!-p+1). We can divide a p out from everything

So really the question is, why is (p-1)!=p-1 (mod p). If you know that Zp is a field you can figure this out. If not, you probably still can, I just don't see how off the top of my head

Gib Z

Homework Helper
"[URL [Broken] Theorem[/URL]
Last edited by a moderator:
Thanks Office Shredder and Gib Z, those were both very enlightening comments.
Good points Office_Shredder I learned something new formula.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving

Hot Threads