Lucas's Theorem
Statement
Let be a prime. Write and in base :
Then
where whenever .
A crucial corollary: for ,
Visualization
Take and compute for ranging from 0 to 24 (rows) and from 0 to 4 (cols). Lucas says the answer is determined by the base-5 digits.
Pascal mod 5 (· = 0, digit shown otherwise)
k: 0 1 2 3 4
m= 0: 1 . . . .
1: 1 1 . . .
2: 1 2 1 . .
3: 1 3 3 1 .
4: 1 4 1 4 1
5: 1 . . . . ← new "row 1" in base 5
6: 1 1 . . .
7: 1 2 1 . .
10: 1 . . . . ← 10 = 2·5+0; top digit row repeats
12: 1 2 1 . .
24: 1 4 1 4 1
The pattern tiles: Pascal's triangle mod is a fractal (Sierpiński-like for ) because each block of the big triangle is a scalar multiple of the first-row entry times the whole small triangle.
Proof Sketch
-
Generating function: In , we have (by the freshman's dream: for ).
-
Digit decomposition: Write and . Then
-
Extract coefficient: The coefficient of on the right factors as .
-
Induction: Apply the same argument to and , inducting on the number of base- digits.
Connections
Lucas's theorem is a powerful tool in combinatorics and number theory. It generalises to prime powers via Granville's theorem. The key ingredient — that for — also drives the binomial theorem proof of Fermat's Little TheoremFermat's Little TheoremFor prime p, a^p is congruent to a mod pRead more →. The digit-wise structure connects to -adic numbers and to Multiplicative FunctionsMultiplicative FunctionsArithmetic functions that split over coprime inputs: f(mn) = f(m)f(n) when gcd(m,n) = 1Read more → (since the number of with is multiplicative in the digit sense). Lucas sequences also play a role in primality tests related to Wilson's TheoremWilson's TheoremA natural number p > 1 is prime if and only if (p-1)! ≡ -1 mod pRead more →.
Lean4 Proof
/-- For a prime `p` and `0 < k < p`, `p` divides the binomial coefficient C(p, k).
This is the key lemma behind Lucas's theorem and the freshman's dream identity.
Mathlib proves it as `Nat.Prime.dvd_choose_self`. -/
theorem prime_dvd_binom_self (p k : ℕ) (hp : Nat.Prime p) (hk : k ≠ 0) (hkp : k < p) :
p ∣ Nat.choose p k :=
hp.dvd_choose_self hk hkp
/-- Freshman's dream: in characteristic p, (1 + x)^p = 1 + x^p.
Mathlib provides `CharP.add_pow_char` for this identity in a ring of char p. -/
theorem freshman_dream (p : ℕ) [hp : Fact p.Prime] (R : Type*) [CommRing R] [CharP R p]
(a b : R) : (a + b) ^ p = a ^ p + b ^ p :=
add_pow_char R a bReferenced by
- Catalan NumbersCombinatorics