Concepts10
Harmonic Lemma
The Harmonic Lemma says that the values of \lfloor n/i \rfloor only change about 2\sqrt{n} times, so you can iterate those value blocks in O(\sqrt{n}) instead of O(n).
Pólya Enumeration
Pólya Enumeration Theorem generalizes Burnside’s Lemma by turning counting under symmetry into a polynomial substitution problem.
Burnside's Lemma
Burnside's Lemma says the number of distinct objects up to a symmetry group equals the average number of objects fixed by each symmetry.
Primitive Roots
A primitive root modulo n is a number g that cycles through all units modulo n when you repeatedly multiply by g, so its multiplicative order equals \(\varphi(n)\).
Divisor Function Sums
Summing the divisor function d(i) up to n equals counting lattice points under the hyperbola xy ≤ n, which can be done in O(√n) using floor-division blocks.
Multiplicative Functions
A multiplicative function is an arithmetic function f with f(mn) = f(m)f(n) whenever gcd(m, n) = 1.
Euler's Totient Function
Euler's Totient Function φ(n) counts how many integers from 1 to n are coprime with n.
Modular Inverse
A modular inverse of a modulo m is a number a_inv such that a × a_inv ≡ 1 (mod m).
Euler's Theorem
Euler’s Theorem says that if a and n are coprime, then a raised to the power φ(n) is congruent to 1 modulo n.
Fast Exponentiation
Fast exponentiation (binary exponentiation) computes a^n using repeated squaring in O(log n) multiplications.