Number theory utilities and functions
Linear sieve computing primes, smallest prime factor (SPF), Euler's totient, and Mobius function in O(n).
Factorize 64-bit integers into primes using Pollard's Rho with Miller-Rabin primality testing.
Primality test, factorization, Euler's totient, divisors, integer sqrt, and perfect power check.
Type-safe modular arithmetic with operator overloading for clean competitive programming code.
Deterministic Miller-Rabin primality test for 64-bit integers using verified witness sets.
Binary exponentiation on square matrices for solving linear recurrences in O(n^3 log k).