But OP's solution does not either, does it?
here is the famous sieve from Wikipedia, yes I know, you shall not trust it,
I do not, but as very often this is correct:
1. Write a list of numbers from 2 to the largest number you want to
test for primality. Call this List A.
2. Write the number 2, the first prime number, in another list for
primes found. Call this List B.
3. Strike off 2 and all multiples of 2 from List A.
4. The first remaining number in the list is a prime number. Write
this number into List B.
5. Strike off this number and all multiples of this number from List
A. The crossing-off of multiples can be started at the square of the number,
as lower multiples have already been crossed out in previous steps.
6. Repeat steps 4 through 6 until no more numbers are left in List A.
···
On 8/2/06, Kroeger, Simon (ext) <simon.kroeger.ext@siemens.com> wrote:
> From: Robert Dober [mailto:robert.dober@gmail.com]
> Sent: Wednesday, August 02, 2006 1:26 PM
>
> On 8/2/06, Paul Battley <pbattley@gmail.com> wrote:
> >
> > On 02/08/06, Robert Dober <robert.dober@gmail.com> wrote:
> > > Enumerations, all the way
> > >
> > > p (2..100).select{|d|!(2..d-1).find{|c|d%c==0}}
> >
> > You can shave a byte off:
> >
> > p (2..100).reject{|d|(2..d-1).find{|c|d%c==0}}p (2..100).select{|d|(2...d).all?{|c|d%c>0}}
But it has nothing to do with Eratosthenes anymore...
cheers
Simon
You are right, too bad, I was having the time of my life
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
- Albert Einstein