Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.8k
Open
Labels
Description
https://codeforces.com/blog/entry/54090
The blog presents a variant that uses a bool array instead oflp
, so the space disadvantage over the Sieve of Eratosthenes is mitigated.
More helpfully, the linear sieve can be modified to compute the range [1,n] of multiplicative function, including Möbius and totient functions (although it's quite easy to modify the sieve of eratosthenes using euler's product formula to calculate totients in range)