Lucas' Theorem/Corollary

Corollary to Lucas' Theorem
Let $p$ be a prime number.

Let $n, k \in \Z$.

Let the representations of $n$ and $k$ to the base $p$ be given by:
 * $n = a_r p^r + \cdots + a_1 p + a_0$
 * $k = b_r p^r + \cdots + b_1 p + b_0$

Then:
 * $\displaystyle \dbinom n k \equiv \prod_{j \mathop = 0}^r \dbinom {a_j} {b_j} \pmod p$

where $\dbinom n k$ denotes a binomial coefficient.

Proof
Consider the representations of $n$ and $k$ to the base $p$:
 * $n = a_r p^r + \cdots + a_1 p + a_0$
 * $k = b_r p^r + \cdots + b_1 p + b_0$

Let:
 * $n_1 = \left \lfloor {n / p} \right \rfloor$
 * $k_1 = \left \lfloor {k / p} \right \rfloor$

We have that:
 * $n \bmod p = a_0$
 * $k \bmod p = b_0$
 * $n_1 = a_r p^{r - 1} + a_{r - 1} p^{r - 2} \cdots + a_1$
 * $k_1 = b_r p^{r - 1} + b_{r - 1} p^{r - 2} \cdots + b_1$

It follows from Lucas' Theorem that:
 * $\dbinom n k \equiv \dbinom {n_1} {k_1} \dbinom {a_0} {b_0} \pmod p$

Now we do the same again to the representation to the base $p$ of $n_1$ and $n_2$.

Thus:
 * $\dbinom n k \equiv \dbinom {\left \lfloor {n_1 / p} \right \rfloor} {\left \lfloor {k_1 / p} \right \rfloor} \dbinom {a_1} {b_1} \dbinom {a_0} {b_0} \pmod p$

and so on until:
 * $\left \lfloor {n_r / p} \right \rfloor$

and:
 * $\left \lfloor {k_r / p} \right \rfloor$

Hence the result.