|
-
Sep 10th, 2009, 01:50 AM
#9
Re: Prime Numbers
 Originally Posted by Nightwalker83
What I'm getting at is just removing the even numbers from the start hence, only finding the odd numbers. This is because 2 can divide into any even number.
That's exactly what it does. Since 2 is the smallest number, it eliminates all multiples of 2 (i.e. all even numbers) in the first loop. Then continues with 3 then 5 then 7 and so on.
The only difference between the two algorithms that make a performance difference is that while in SieveOfEratosthenes a number can come for elimination more than once, in EulersSieve any number can come for elimination only once.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|