Shortest prime number program

Jeffrey Schwab jeff at schwabcenter.com
Sat Feb 11 11:55:44 EST 2006


dickinsm at gmail.com wrote:
> swisscheese wrote:
> 
>>r=range(2,99)
>>m=[x*y for x in r for y in r]
>>[x for x in r if not x in m]
> 
> 
> How about:
> 
> [2]+[x for x in range(1,99) if 2**x%x==2]

43.

I'll be chewing on this one for a while.  Thank you. :)



More information about the Python-list mailing list