You are right. This isn't exactly sieve of Eratosthenes. My plan was to implement it, but instead, I wrote this, because it was simpler (at least for my knowledge of Clojure). But since it's too slow, I'll transform it to real sieve of Eratosthenes, to check it's performance.
On Jan 27, 2:43 pm, "twitter.com/nfma" <nuno.filipe.marq...@gmail.com> wrote: > hmm... I'm just learning clojure at the moment but by looking at code what I > see is: > > 1 - A collecting parameter called primes > 2 - A test to verify if a number is a prime by calculating the reminder of > the division with all (or some) of the primes already found > 3 - if a number is a prime then its added to the primes list > > if the above is true then this is not the sieve of Eratosthenes... > > at least according to > wikipedia:http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes > > I've never tried the Sieve of Atkins, must give it a go and check if it's > faster and if yes how fast. > > Cheers, > Nuno > > 2010/1/27 Meikel Brandmeyer <m...@kotka.de> > > > Hi, > > > On Jan 26, 5:38 pm, "twitter.com/nfma" <nuno.filipe.marq...@gmail.com> > > wrote: > > > > You can use the sieve of Eratosthenes... > > > This actually is the sieve of Eratosthenes. If one really wants to go > > out of one's way, one can investigate the sieve of Atkin (or other > > improved variants) and the the various ways of optimising the > > algorithm (primitives + type hintes, loops, etc.). > > > Sincerely > > Meikel > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en