Ejemplo n.º 1
0
def main(n):
  """Return the sum of all the primes below n"""
  i = 3
  s = 2
  while i<n:
    if is_prime(i):
      s += i
    i += 2
  return s
Ejemplo n.º 2
0
def find_primes(n):
  '''
  Find the nth first prime numbers
  '''
  primes = [2]
  i = 3
  while len(primes)<n:
    if is_prime(i):
      primes.append(i)
    i += 2
  return primes