You can use the sieve of Eratosthenes...

2010/1/26 Nebojsa Stricevic <nebojsa.strice...@gmail.com>

> 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 <chou...@gmail.com> wrote:
> > On Tue, Jan 26, 2010 at 9:52 AM, Meikel Brandmeyer <m...@kotka.de>
> wrote:
> > > Hi Chris,
> >
> > > On Jan 26, 3:33 pm, Chouser <chou...@gmail.com> 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 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

Reply via email to