Concepts3
∑MathIntermediate
Lucas' Theorem
Lucas' Theorem lets you compute C(n, k) modulo a prime p by working digit-by-digit in base p.
#lucas theorem#binomial coefficient modulo p#prime power modulus+12
∑MathIntermediate
Linear Sieve
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).
#linear sieve#smallest prime factor#spf+12
∑MathIntermediate
Prime Factorization
Prime factorization expresses any integer greater than 1 as a product of primes raised to powers, uniquely up to ordering.
#prime factorization#trial division#spf sieve+12