Click here to Skip to main content
15,903,175 members

Articles by Bill Anderson (Tip/Tricks: 2)

Tip/Tricks: 2

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 5.00

Programming Languages
C#
12 Sep 2011   Updated: 12 Sep 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 16,231     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Here's an alternative. This one uses the BitArray class in C# and does not use the % operator.static List SeiveWithoutMod(int candidate){ BitArray sieveContainer = new BitArray(candidate + 1, true); int marker = 2; //start int factor = 2; //start. sieveContainer[0]...
28 Sep 2011   Updated: 30 Sep 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 14,521     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Hi,Thanks for the feedback for alternative #1 from above (and thank you, Jurgen Rohr for your suggestion! I replaced the "reset" line with:while (!sieveContainer.Get(++marker));factor = marker;Here is another algorithm that's slightly different. It's not as elegant an approach, but...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Web Developer
United States United States
Developer