THE FOLD / GRIND / THE MAINFRAME / THE LUCAS THEOREM
THE LUCAS THEOREM
a giant binomial mod p from base-p digits alone
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Lucas’ theorem computes a giant binomial coefficient mod a prime p using only the digits of the numbers in base p. Write m and n in base p; then C(m,n) mod p equals the product of C(mᵢ, nᵢ) mod p over corresponding digits.
So C(1000, 500) mod 7 — a number with hundreds of digits — is found by multiplying a handful of tiny binomials. A striking corollary: C(m,n) is odd (nonzero mod 2) exactly when n’s binary digits are a subset of m’s — which is why Pascal’s triangle mod 2 is the Sierpiński triangle.
LIT verified live: the digit-product formula equals a direct computation of C(m,n) mod p across 300 cases for primes 2,3,5,7,11 (window.__lucastheorem). FIG no framing; exact modular arithmetic.
So C(1000, 500) mod 7 — a number with hundreds of digits — is found by multiplying a handful of tiny binomials. A striking corollary: C(m,n) is odd (nonzero mod 2) exactly when n’s binary digits are a subset of m’s — which is why Pascal’s triangle mod 2 is the Sierpiński triangle.
LIT verified live: the digit-product formula equals a direct computation of C(m,n) mod p across 300 cases for primes 2,3,5,7,11 (window.__lucastheorem). FIG no framing; exact modular arithmetic.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-mainframe — the arithmetic engine crunching astronomically large binomials down to a residue. Lucas’ theorem is the mainframe’s shortcut: skip the giant number, read the digits. AVAN (AI) built the instrument: the base-p digit decomposition, the digit-product, the direct-computation cross-check, the Pascal-mod-2 fractal.
Credit as content: Édouard Lucas (1878). The weave: David names the mainframe; I split m and n into base-p digits, multiply the tiny per-digit binomials, and confirm the result matches the full coefficient reduced mod p.
Credit as content: Édouard Lucas (1878). The weave: David names the mainframe; I split m and n into base-p digits, multiply the tiny per-digit binomials, and confirm the result matches the full coefficient reduced mod p.
3 ONE DIMENSION
m and n written in base p, digit above digit. Each column contributes a small binomial C(mᵢ, nᵢ) mod p, and their product is the whole coefficient mod p — no carrying between columns.
4 TWO DIMENSIONS · INTERACTIVE
Choose m, n, and a prime p. See the base-p digits, the per-digit binomials, and their product — checked against a direct C(m,n) mod p. Below, Pascal’s triangle mod 2 draws the Sierpiński fractal.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: Pascal’s triangle mod p, its self-similar pattern of nonzero residues.
AVAN’s addition (the inverse-companion): a global quantity — a huge combinatorial number — is determined by local digit data. The whole coefficient mod p factors into independent per-digit pieces, with no carrying between them. The inverse of ‘compute C(m,n) then reduce’ is ‘reduce each digit independently and multiply.’ That digit-locality is exactly why Pascal’s triangle mod p is self-similar: the pattern at scale pᵏ is p copies of the pattern at scale pᵏ⁻¹ — a fractal. Magenta is the full uncomputed binomial; green is the tiny digit binomials whose product is the answer. And Kummer extends it: the power of p dividing C(m,n) counts the carries when adding n and m−n in base p. Digits decide the whole.
LIT Genuine Lucas' theorem (Lucas 1878). Verified live: writing m,n in base p and multiplying the per-digit binomials C(m_i,n_i) mod p equals a direct Pascal-computed C(m,n) mod p for 300 random cases across primes 2,3,5,7,11 (window.__lucastheorem.digitProductMatches); C(1000,500) mod 7 = 4.
FIG No framing: the base-p digit decomposition, the digit-product, the direct cross-check, and the Pascal-mod-2 Sierpinski render run in-browser and are exact. The AVAN inverse is honest — the coefficient mod p factors into independent per-digit pieces with no carrying, which is exactly why Pascal mod p is self-similar (fractal); Kummer's extension counts carries. Ties to chaos-game/Sierpinski.
FIG No framing: the base-p digit decomposition, the digit-product, the direct cross-check, and the Pascal-mod-2 Sierpinski render run in-browser and are exact. The AVAN inverse is honest — the coefficient mod p factors into independent per-digit pieces with no carrying, which is exactly why Pascal mod p is self-similar (fractal); Kummer's extension counts carries. Ties to chaos-game/Sierpinski.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE MAINFRAME · David Lee Wise (ROOT0), with AVAN