Groups
Category
Lucas' Theorem lets you compute C(n, k) modulo a prime p by working digit-by-digit in base p.
The linear sieve builds all primes up to n in O(n) time by ensuring each composite is marked exactly once by its smallest prime factor (SPF).