Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 44s1 days 16 hours 1 minutes 44 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 44s1 days 16 hours 1 minutes 44 seconds.

Sign in to watch this lesson
Advanced - Combinatorics, Games and Puzzles · 5:08
The textbook n! / (k! (n - k)!) with a modular inverse only works modulo a large prime. For a small prime, Lucas's theorem multiplies the binomials of the base-p digit pairs, which for p = 2 turns into a bit test and draws the Sierpinski triangle; for a prime power we strip the prime out of every factorial and track its exponent; and any other modulus is split into prime powers and recombined with the Chinese remainder theorem.