**Unformatted text preview: **@returns: a list of the primes """ primes = [2] #the only prime we know is 2 for num in range(3, max_prime_search + 1, 2): #only odd numbers can be prime for prime in primes: if(num % prime == 0): #the number was evenly divisible by a prime isPrime = False #so it must not be prime break #and there is no reason checking against the rest of the numbers else: #the number is prime primes.append(num) #add it to the list of primes return primes def main(): max_prime_search = get_max_search() primes = list_primes(max_prime_search) for prime in primes: print(prime) main()...

View
Full Document

- Fall '07
- Amenta
- Prime number, valid upper bound