Optimizing Eratosthenes' Sieve... more?

Announcements, comments, ideas, feedback, and "How do I... ?" questions
Post Reply
Vanguard
Posts: 1
Joined: Tue Jun 26, 2012 11:06 pm

Optimizing Eratosthenes' Sieve... more?

Post by Vanguard »

Hello everybody.
A while ago I implemented the prime number finder of Problem 10, the second version, which discriminates even numbers.

My question: is it worth pursuing further optimization, by also cutting out numbers divisible by 3, 5, 7, 11, 13, etc?
(Obviously, only up to a reasonable value.)
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Optimizing Eratosthenes' Sieve... more?

Post by Lord_Farin »

I cut it for three also, but the management is tedious and very hard to get correct.
Obviously, there is a speed effect, and since one needs less memory as well (cutting one third, of course), there is really something to be gained here.
Image
Post Reply