primes

John Thingstad john.thingstad at chello.no
Mon Oct 22 04:08:02 EDT 2001


reusing n is probably confusing. Try this then:

def prime(max):
	set = [2] + range(3,max, 2)
	for n in range(3, int(math.sqrt(max))+1, 2):
		set = [x for x in set if x == n or x % n != 0]
	return set








More information about the Python-list mailing list