Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 37s1 days 16 hours 1 minutes 37 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 37s1 days 16 hours 1 minutes 37 seconds.

Sign in to watch this lesson
Advanced - Number Theory · 4:13
The linear sieve fills lp[x], the smallest prime factor of every x up to n, writing each composite exactly once as lp[x] times a larger part whose own smallest prime is no smaller. It costs an int per number, so it is used up to about 10^7, and its real payoff is factoring any x in the table by hopping along lp[] in at most log2(x) steps.