https://codeforces.com/blog/entry/54090
With minor changes to the linear prime sieve, there's actually a way to linearly sieve any multiplicative function (phi, mobius, divisor, etc).
You just need to define f(p^k) where f is the multiplicative function and p is a prime. This uniquely identifies a multiplicative function.
I propose we add this generalized linear sieve.