Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The (little) Fermat Theorem:

if $p$ is prime then $a^{p-1}=1\ \text{mod} \ p$ for whatever $a$

may be easily understood as a consequence of the group structure of multiplication on integers mod $p$.

Considering addition and multiplication, the stucture is extended to a ring, where Lagrange's lemma on the identity of polynomials with identical roots holds. Wilson's identity can then be seen as a consequence of the ring structure: since both polynomials of degree $p-1$

$P(z)=(z-1)(z-2)...(z-(p-2))(z-(p-1))$ and


have the same roots mod $p$ (the first by construction, the second by virtue of Fermat's Theorem) it follows that their free terms should be equal:

if $p$ is prime then $(p-1)!=-1\ \text{mod} \ p$

which would almost be Wilson's theorem. This last is in fact stronger since it includes the reciprocal too, being therefore a primality test for $p$.

My actual question is: when writing the above demonstration, why are not usually equated the remaining coefficients of $z^k$ in order to obtain a host of Wilson-like identitites? Considering the coefficient of $z$ would thus obtain

$\sum_{j=1}^{p-1}({1\cdot 2\cdot 3 ...\not{j}...(p-2)\cdot(p-1)})=0\ \text{mod}\ p$

or equivalently

$\sum_{j=1}^{p-1}\ \frac{1}{j}=0\ \text{mod}\ p$.

The general form derived from the coefficient of $z^k$ would then read

$H_k(p-1)=\sum_{j=1}^{p-1}\ \frac{1}{j^k}=0\ \text{mod}\ p$, which holds for $p > k$.

Here $H_k(p-1)$ is the harmonic number of order $k$, which accordingly has to be 0 mod $p$ if $p$ is prime.

How are these identities called and why are they not mentioned in the context of Wilson' Theorem?

share|cite|improve this question
It is done, often as exercises in number-theory texts. – André Nicolas Dec 14 '12 at 0:27
Thank you André, I managed to find a few references. – Lupercus Dec 14 '12 at 10:33
There is in fact nothing special to these identities involving the harmonic numbers. In the same way one can show that the binomial coefficients have to satisfy $ C_{p}^{k} = 0\ \text{mod} \ p$ for $p$ prime and $k=2,3, ..., p-1$ since $(1+z)^p = (1+z)\ \text{mod}\ p$ for all $z$ by Fermat Theorem. This last one is therefore the key result, although formulated in a poorer structure (group vs field). – Lupercus Dec 21 '12 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.