Number theory and algebraic algorithms
Find the smallest primitive root (generator) modulo a prime p.
Modular multiplicative inverse via Fermat's little theorem, extended Euclidean, and linear precomputation.
Safe modular add, multiply, binary exponentiation, Russian peasant multiplication, and big mod.
GCD, LCM, Extended Euclidean algorithm, and linear Diophantine equation solver.
Fast exponentiation using binary representation of the exponent in O(log n) multiplications.