Christoph Zwerschke wrote:
> [EMAIL PROTECTED] schrieb:
>> How about:

>> [2]+[x for x in range(1,99) if 2**x%x==2]

> If the range goes beyond 340, it also gives non-primes...

[2,3]+[x for x in range(1,99) if 2**x%x==2 and 3**x%x==3]
[2,3,5]+[x for x in range(1,99) if 2**x%x==2 and 3**x%x==3 and 5**x%x==5]

SCNR, Ralf

PS: They both break at 561, and further strengthening of the
condition will not help.  Manual loop unrolling as follows works:

[2,3,... <insert all primes here>]+[x for x in range(1,99) if False]

For sufficiently small values of 99, this will also be a rather
short program.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to