Groups
Category
Level
A multiplicative function is an arithmetic function f with f(mn) = f(m)f(n) whenever gcd(m, n) = 1.
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).
The Sieve of Eratosthenes marks multiples of each prime to find all primes up to n in O(n log log n) time.