Shortest prime number program

Grant Edwards grante at visi.com
Sat Feb 11 09:07:29 EST 2006


On 2006-02-11, swisscheese <jimlewis at miclog.com> wrote:
>>You can save two bytes with
>
> 56 - nice catch.
> 55:
> r=range(2,99)
> [x for x in r if sum(x%d<1 for d in r)<2]

And if this were FORTRAN:

r=range(2,99)
[xforxinrifsum(x%d<1fordinr)<2]

;)

-- 
Grant Edwards                   grante             Yow!  Hmmm... a CRIPPLED
                                  at               ACCOUNTANT with a FALAFEL
                               visi.com            sandwich is HIT by a
                                                   TROLLEY-CAR...



More information about the Python-list mailing list