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

Algorithms

 
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
73Zeppelin2-Dec-08 22:28
73Zeppelin2-Dec-08 22:28 
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 
Certain optimizations can be made to a classic or implied-two-spoke sieve that won't work for more spokes.

If it's hard-coded to only count the primes, it'll be quicker too.
For mine, I pass in a delegate of what to do with each prime, so I have a lot more method calls.


C:\>Eratosthenes 4294967296 Three
Target=4294967296; Spokes=(30,8); Bytes=(17895704,143165632); Elapsed=00:04:53.1354700; Primes=203280221
                           ^  ^              ^        ^
                           |  |              |        |
Total spokes ---------------  |              |        |
Allocated spokes --------------              |        |
Bytes per array ------------------------------        |
Total bytes allocated for arrays ----------------------



Luc Pattyn wrote:
I do expect spokes to improve performance a lot


Try it, you'll see. Big Grin | :-D


How would you cross off the 25?

1  7 13 19 25 31
5 11 17 23 29 35


This is an area that still needs work, and I think I may have an idea...
GeneralRe: Wheel Factorization to simplify a Sieve of Eratosthenes Pin
Luc Pattyn3-Dec-08 5:53
sitebuilderLuc Pattyn3-Dec-08 5:53 
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 

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.