You can use the sieve of Eratosthenes... 2010/1/26 Nebojsa Stricevic <[email protected]>
> Thanks a lot for help. I have much better understanding of laziness > now! But I guess I'll need to do some more math research, because both > algorithms provided here (my + removed laziness and the one from > Meikel) are too slow for calculating all primes below 2000000. > > On Jan 26, 4:48 pm, Chouser <[email protected]> wrote: > > On Tue, Jan 26, 2010 at 9:52 AM, Meikel Brandmeyer <[email protected]> > wrote: > > > Hi Chris, > > > > > On Jan 26, 3:33 pm, Chouser <[email protected]> wrote: > > > > >> Of course with this algorithm you *need* filter to be lazy, or > > >> you'd never get past the first iteration of the loop. > > > > > I'm sorry. I have to ask. > > > > > Why? > > > > Hm, now that you ask, I see I didn't read the code carefully > > enough. I was assuming the numbers seq was infinitely long. > > > > --Chouserhttp://joyofclojure.com/ > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected]<clojure%[email protected]> > 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
