Linear sieve
I have mastered the screen Erichsen Why learn linear screen ???
Sieve linear time complexity is strictly \ (O (N) \) , and the complexity of the Eppendorf sieve is $ O (N * log_ {2 } (log_ {2} (N)) $
It did not seem much faster It is actuallyBut when dealing with a large number of data, it highlighted the gap
Algorithm thinking
Overview:
Erichsen and similar sieve
Linear sieve is to enumerate the number is multiplied by a current smaller than the smallest prime factors of the prime number to the number of sieve
(Above this sentence is a bit long, we need to understand again Temporarily can not understand, it does not matter, I'll wait for the next code speak in detail)
This ensures that almost every case of a heavy screen does not appear, greatly reducing the number of cycles
Code: