Lucas's theorem (source code)

= Lucas's theorem
{c}
{title2=$\binom nk\equiv\prod_i\binom{n_i}{k_i}\pmod p$}
{wiki}

= Lucas theorem
{c}
{synonym}

For a <prime number> $p$, the <binomial coefficient> modulo $p$ factors into the corresponding digit <binomial coefficients> in the <base-p expansions> of the nonnegative <integers> $n,k$. Pad both expansions to the same length and use $\binom ab=0$ when $b>a$. The identity follows by factoring $(1+x)^n$ into digit powers and using the <Frobenius endomorphism>; digit uniqueness identifies each coefficient.