Click here to Skip to main content
15,890,512 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
Luc Pattyn2-Dec-08 23:15
sitebuilderLuc Pattyn2-Dec-08 23:15 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
73Zeppelin3-Dec-08 0:14
73Zeppelin3-Dec-08 0:14 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
PIEBALDconsult3-Dec-08 4:11
mvePIEBALDconsult3-Dec-08 4:11 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
Luc Pattyn3-Dec-08 5:45
sitebuilderLuc Pattyn3-Dec-08 5:45 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
PIEBALDconsult3-Dec-08 16:16
mvePIEBALDconsult3-Dec-08 16:16 
GeneralA la recherche des nombres premiers Pin
Luc Pattyn3-Dec-08 16:37
sitebuilderLuc Pattyn3-Dec-08 16:37 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
PIEBALDconsult3-Dec-08 5:06
mvePIEBALDconsult3-Dec-08 5:06 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
Luc Pattyn3-Dec-08 5:53
sitebuilderLuc Pattyn3-Dec-08 5:53 
Hi,

thanks for the clarification.

PIEBALDconsult wrote:
I pass in a delegate of what to do with each prime


I don't. I might do that when I am done, right now I do not want to wait for a machine to execute millions of delegates I do not really need. I call a non-virtual method for each prime; it displays a few of them, and keeps track of count.

PIEBALDconsult wrote:
Try it, you'll see.


I will.


PIEBALDconsult wrote:
How would you cross off the 25?


I am considering only one array containing the primes of all relevant spokes; I currently store 1, 3, 5, 7, 9, 11, 13, 15 etc because the odd one is the only relevant spoke in a two-spoke setup. In the six-spoke scenario that would be 1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, etc.

Therefore 25, just like any other non-prime, will be flagged as composite, every time it appears as a multiple of one of its factors; in this case that would be only once, and it would also be the first relevant multiple of prime 5.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


AnswerRe: Wheel Factorization to simplify a Sieve of Eratosthenes [modified] Pin
PIEBALDconsult9-Jan-09 11:53
mvePIEBALDconsult9-Jan-09 11:53 
QuestionEfficient Search/Comparison Algorithm Pin
SanchitK20-Nov-08 3:29
SanchitK20-Nov-08 3:29 
AnswerRe: Efficient Search/Comparison Algorithm Pin
Member 419459320-Nov-08 6:17
Member 419459320-Nov-08 6:17 
AnswerRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany20-Nov-08 10:20
Alan Balkany20-Nov-08 10:20 
AnswerRe: Efficient Search/Comparison Algorithm Pin
cmk20-Nov-08 12:59
cmk20-Nov-08 12:59 
GeneralRe: Efficient Search/Comparison Algorithm Pin
Member 419459320-Nov-08 14:18
Member 419459320-Nov-08 14:18 
GeneralRe: Efficient Search/Comparison Algorithm Pin
cmk20-Nov-08 16:21
cmk20-Nov-08 16:21 
GeneralRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany21-Nov-08 3:35
Alan Balkany21-Nov-08 3:35 
GeneralRe: Efficient Search/Comparison Algorithm Pin
supercat921-Nov-08 9:44
supercat921-Nov-08 9:44 
GeneralRe: Efficient Search/Comparison Algorithm Pin
Alan Balkany21-Nov-08 11:35
Alan Balkany21-Nov-08 11:35 
Question[Message Deleted] Pin
De@r17-Nov-08 3:45
De@r17-Nov-08 3:45 
AnswerRe: convert bubble sort to quick sort Pin
73Zeppelin17-Nov-08 5:48
73Zeppelin17-Nov-08 5:48 
QuestionWumpus problem Pin
hockymot2008_200915-Nov-08 3:32
hockymot2008_200915-Nov-08 3:32 
AnswerRe: Wumpus problem Pin
Reynolds Glisner15-Nov-08 13:23
Reynolds Glisner15-Nov-08 13:23 
GeneralRe: Wumpus problem Pin
hockymot2008_200916-Nov-08 4:25
hockymot2008_200916-Nov-08 4:25 
GeneralRe: Wumpus problem Pin
Member 419459316-Nov-08 4:59
Member 419459316-Nov-08 4:59 
GeneralRe: Wumpus problem Pin
Mark Churchill16-Nov-08 13:07
Mark Churchill16-Nov-08 13:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.