everybody has already read about the the ancient Greek mathematician Eratosthenes (250 BCE). A basic algorithm could be found at http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

but why in the optimizing algorithm, the variable i should not exceed square root of n ? 113 more words