2010/1/27 Meikel Brandmeyer <m...@kotka.de>:
> Dang. Details matter.

:-)

2010/1/27 Nebojsa Stricevic <nebojsa.strice...@gmail.com>:
> I've transformed algorithm to this:
>
> [ ... elided ... ]
>
> And I think, that this is real SoE, and it can calculate sum of first
> 2000000 prime numbers in ~35 sec, on 1.4 Celeron M.

I'd go as far as to say that it models a hand-performed SoE run
supremely closely (including skipping over the beginning of the list
when finding the next prime after crossing out the multiples of the
previous one). That in itself is very nice indeed!

Strangely, while it computes all primes below 2000000 without a
problem (in ~7-8 s on my machine), it throws an IndexOutOfBounds when
the upper bound given is odd (try (primes-below 21)). The simple
solution would be to add 1 to odd upper bounds at the start.

Also, I think you meant the sum of the primes under 2000000, the first
2000000 primes would be hard to obtain using this function. Still, a
cool and very readable purely functional non-incremental sieve. :-)

Sincerely,
Michal

-- 
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