Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

Suppose that $p$ is a prime. Suppose further that $h$ and $k$ are non-negative integers such that $h + k = p − 1$.

I want to prove that $h!k! + (−1)^h \equiv 0 \pmod{p}$

My first thought is that by Wilson's theorem, $(p-1)! \equiv -1 \pmod{p}$, and $h!k!$ divides $(p-1)!$ (definition of a binomial). Where would I go from here?

share|cite|improve this question
up vote 3 down vote accepted

Use the fact that

$$h! = (-1)^h (p-1)(p-2) \dots (p-h) \mod p$$

share|cite|improve this answer
Ah, so h!k! becomes [(-1)^h](p-1)! mod p, which is just -(-1)^h. Thanks so much! – Johan Feb 27 '11 at 22:59

Hint $\ $ Wilson's theorem implies that any complete system of representatives of nonzero remainders mod $\,p\,$ has product $\equiv -1.\,$ In particular this is true for any sequence of $\,p\,$ consecutive integers, after we remove its unique $\rm\color{#c00}{multiple}$ of $\,p.\,$ Your special case is the sequence $$\, -h,\,-h\!+\!1,\ldots,-1,\require{cancel}\color{#c00}{\cancel{0,}} 1,2,\ldots, k\ \ \ \text{whose product is}\,\ \ (-1)^h h!\,k!\equiv -1$$

Remark $\ $ This is slight reformulation of the Wilson reflection formula mentioned yesterday

$$ k! = (p\!-\!1\!-\!h)! \equiv \frac{(-1)^{h+1}}{h!}\!\!\pmod p,\ \text{ for $\,p\,$ prime} $$

share|cite|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.