kirby urner wrote:
Excellente! kind sir.
Here's a Python solution from Kay Schluehr on python-list. I've pretty-printed it, sort of. If the line endings get garbled, just look for the backslashes:

g = (lambda primes = []: \
       (n for n in count(2) if \
           (lambda n, primes: \
               (n in primes if (primes and n<=primes[-1]) \
else (primes.append(n) or True if all(n%p for p in primes if p <= sqrt(n)) \
                                                           else False) \
               ) \
           )(n, primes) \
       ) \
   )()

"g" is a generator, so get the values with g.next().


On Sat, Apr 4, 2009 at 2:30 PM, Edward Cherlin <echer...@gmail.com> wrote:
Your message text got stuck in an attachment, where I almost missed
it. I wonder what your mail system thinks it is doing? Comment below.
Yes, I know it's bad. This message is sent from Thunderbird 2.0.0.21, instead of MS-Outlook 2003. Any better?

-John

_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to