title: Listing all primes below N using Euclid infinitude of prime proof
body: <p>Here is the question:</p>
  
  <blockquote>
    <p>Write a function that accepts a bound N, and finds the first N
    primes as determined by the classical proof of the infinitude of the set
    of primes. That is: begin with P = {2}; then form, m, the sum of
    1 with the product over all elements of P. Place the smallest prime
    factor of m into P and repeat.</p>
  </blockquote>
  
  <p>And here is what I did:</p>
  
  <pre><code>def get_primes(n):
      i = 2
      prime_list = []
      while i &lt; n:
          p = prod(prime_list)+1
          r = min_symbolic(prime_divisors(p))
          prime_list.append(r)
          i = i+1
     return prime_list
  </code></pre>
  
  <p>It gave me a bunch of errs when I tried get_primes(10), what did I do wrong here? I just started learning python, thanks.</p>
  
  <p>EDIT: sorry for not being clear, here are the errors I'm getting</p>
  
  <pre><code>Error in lines 1-1
  Traceback (most recent call last):
  File "/projects/3fe731e3-2b4d-43b9-86a0-5efb4456f029/.sagemathcloud/sage_server.py", line 881, in execute
  exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in &lt;module&gt;
  File "", line 6, in get_primes
  File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/rings/arith.py", line 2538, in prime_divisors
  return [p for p,_ in factor(n)]
  TypeError: 'sage.symbolic.expression.Expression' object is not iterable
  </code></pre>