A Question About Erasthmus' Sieve
Students of Mathematics are familiar with Erasthmus' Sieve. 2 x 3 x 4 x 5 x 6 x x 7 8 x 9 x 10 x x 11 12 x x 13 14 x 15 x x 16 x 17 18 x x 19 20 x x 21 x 22 x 23 First, we strike all multiples of 2 up to the square root (5.) Then all multiples of 3, then all multiples of 5, etc. I wrote a digital implementation of the Sieve, and used the index creatively, to keep track of the multiples. To "strike" an integer, I set the value of the relevant array entry to 2. In writing the code, I soon observed that as I asked the machine not to look at 2's, the first prime was an obstacle. To overcome this, I wrote a separate loop for 2's, and then began from three, only using the "strike array entry" function only on non-2 array entries. This was very satisfactory, and I was able to develop a list of all primes < 2 ** 2