Sieve Algorithm for Finding Smaller Prime of A Number
-Start from the smallest Prime "2", cross out Prime number's multiples from the square of the Prime Number (sfs-cfs)
-Stop when the Prime number's square is bigger than the Number (sws)
Question:
why from the square? very simple, the multiples of the current Prime less than the current Prime square, already been crossed by the cross processes of those Primes less than the current Prime. For example, let us say current Prime is 7, the multiples of 7 to be removed is 2x7, 3x7 (crossed by 3), 4x7 (crossed by 2), 5x7 (crossed by 5),6x7 (crossed by 2).
why stop when square is bigger than? even simpler, because nothing to be crossed out any more over the Prime square
Can we do even better?