Add new comment


This is probably the clearest guide to understanding Sundaram's Sieve but I feel like I'm either interpreting the instructions incorrectly or their's a minor error on this post.

First off, you state that I start with 4 and increment by 3, then I start at 7 ( adding 3 ) and increment by 5 ( adding 2 ). What's the need for any further incrementation to produce a third or more array of numbers when, through the subtracting you described, we will still get the same array of numbers ( 3, 5, 7, 9, 11, 13, etc. )

You say that if I apply 2n + 1 to the array of numbers generated ( 3, 5, 7, 9, 11, 13, etc. ), the answer will always be no, i.e. the number won't be prime. However, if I apply 2n + 1 to, lets say, 3, I get 7 which IS a prime number.

I'd also like to point out that the first number you state this is "not in the array" ( 5 ), is actually in the array! Applying 2n + 1 to the numbers not in the array still gives composite numbers as well such as 4. 2(4) + 1 = 9, which isn't a prime number.

I'd be extremely grateful if the explanation was either fixed or if my error in interpretation could be corrected.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.