title: How to get a prime collection within 2^63 - 1 in Python
body: <p>I want to get a prime number set within 2^63 - 1 in Python,I have seen the following code on the web:</p>
  
  <pre><code>limit = 2**63 - 2
  p = [True] * (limit + 1)
  # p = bitarray(limit + 1)
  p[0] = p[1] = False
  for i in range(2, int(math.sqrt(limit) + 1)):
      if p[i]:
          for j in range(i * i, limit + 1, i):
              p[j] = False
  prime = [i for i in range(limit + 1) if p[i]]
  print(prime)
  </code></pre>
  
  <p>But when I run this program, the compiler complains that <code>can not fit 'int' into an index-sized integer</code>.
  I tried to solve the problem with bitarray, but the index of the array is still too big.</p>