1. ## Wilson theorem

Hi everybody,

I am looking on wilson theorem and i find this:

(p-1)! = -1 (mod p) iif p is prime.

I have nowhere find this:

(p-1)! = (p-1) (mod p) iif p is prime.

Why the first notation is used???

2. It really all depends on what you know at this point, there are a ton of proofs of this. I think the most elementary way is by noticing that $\displaystyle \mathbb{Z}_p$ is a field. In particular the nonzero elements form a group under multiplication. Inverses are unique, so when you look at

$\displaystyle (p-1)!=\prod_{x=1}^{p-1}x$ you are just left with the product of things that are their own inverse. That is the things such that $\displaystyle x^2=1$, this is clearly 1 and $\displaystyle -1 \equiv p-1$ (mod p).

Thus $\displaystyle (p-1)!=\prod_{x=1}^{p-1}x\equiv p-1 \equiv -1$ (mod p).

The converse is trivial because if $\displaystyle \mathbb{Z}_n$ when n is composite, say n=jk. Then (p-1)!=0 because j and k are zero divisors.

3. First of all thank you for your time.
Indeed if you use ring theory with desired properties (ex. inverting elements), yes you have the desired result.
However here my objection comes. Why we use not real models and properties to show the simple logic? There is not negative modulo between integers. Also there are no identical integer inverses into real world.
When i first noticed wilson theorem (use for a computer algorithm) I totaly confuded.
I had to look at other theories that have other axioms than these we sense.
Anyway thank you again.

4. I am not entirely sure I follow what you mean? There are an infinite number of negative numbers congruent to any of the least positive residues. And as far as not using modular arithmetic in the "real world", I gotta say I disagree with you. We use modular arithmetic all the time in the real world. Ever look at the clock? It is mod 12.

I am kind of interested in what computer algorithm you encountered that used Wilson's Theorem. I have seen it come up in some pretty strange places, and it amazes me when such a seemingly arbitrary relation is so useful. I recall once getting it out of the class equation or Sylow Theorem, I forget now. It came out of some Galois Theory stuff I was doing too this semester.

5. I work on prime numbers detection (for my own interest) via computer algorithm.
As soon i have something interesting i type it in this forum.

Because i need it for furter use, i am trying to aproach defferently wilson's theorem.
i focus in the following tecnique:

I try to relate the patterns (p-n)! % p together.
I noticed that (p-2) % p = 1 (this implied also from your answer)
-p is prime, % is modulo
Anyway if i have something interesting i type it.
Thanks again

6. I assume you meant $\displaystyle (p-2)$!$\displaystyle \equiv 1$ % p. But yes, that is also true, in fact I remember when I first learned Wilson's Theorem in number theory, I was surprised this was not the way it was stated as it seems much nicer to get 1 than -1.

I do not know how much background you have in number theory, but I suggest investigating Quadratic Reciprocity some, it may prove useful for you in your work. Wikipedia has a pretty lengthy article on this and lots of fascinating results with primes. Quadratic reciprocity - Wikipedia, the free encyclopedia

Take care.

7. I ll check,
Thanks

8. Also check the following:

(p-1)!/a % p != (p-1)!/b % p

a, b <p, % modulo, p prime, != inequality.

I encountered this is in factorization of Zeta fucntion!

9. Give you more info when i am more certain for something

10. Sorry i also forgotten:
Sum[(p-1)!/n {n,1,p-1}] % p = 0
Test it. Proof is easy for this (by using reciprocals on adding first and last terms)