class_docstr: A list of prime numbers, implemented as a dynamically
  growing sieve of Eratosthenes. When a lookup is requested involving
  an odd number that has not been sieved, the sieve is automatically
  extended up to that number. Implementation details limit the number of
  primes to ``2^32-1``.
  
  Examples
  ========
  
  >>> from sympy import sieve
  >>> sieve._reset() # this line for doctest only
  >>> 25 in sieve
  False
  >>> sieve._list
  array('L', [2, 3, 5, 7, 11, 13, 17, 19, 23])
class_docstr_tok: ["A","list","of","prime","numbers",",","implemented","as","a","dynamically","growing","sieve","of","Eratosthenes",".","When","a","lookup","is","requested","involving","an","odd","number","that","has","not","been","sieved",",","the","sieve","is","automatically","extended","up","to","that","number",".","Implementation","details","limit","the","number","of","primes","to","``","2^32-1","``",".","Examples","========",">",">",">","from","sympy","import","sieve",">",">",">","sieve._reset","(",")","#","this","line","for","doctest","only",">",">",">","25","in","sieve","False",">",">",">","sieve._list","array","(","'","L","'",",","[","2",",","3",",","5",",","7",",","11",",","13",",","17",",","19",",","23","]",")"]
docstr: Grow the sieve to cover all primes <= n.
  
  Examples
  ========
  
  >>> from sympy import sieve
  >>> sieve._reset() # this line for doctest only
  >>> sieve.extend(30)
  >>> sieve[10] == 29
  True
docstr_tok: ["Grow","the","sieve","to","cover","all","primes","<","=","n.","Examples","========",">",">",">","from","sympy","import","sieve",">",">",">","sieve._reset","(",")","#","this","line","for","doctest","only",">",">",">","sieve.extend","(","30",")",">",">",">","sieve","[","10","]","==","29","True"]
code: def extend(self, n):
      """Grow the sieve to cover all primes <= n.
  
      Examples
      ========
  
      >>> from sympy import sieve
      >>> sieve._reset() # this line for doctest only
      >>> sieve.extend(30)
      >>> sieve[10] == 29
      True
      """
      n = int(n)
      # `num` is even at any point in the function.
      # This satisfies the condition required by `self._primerange`.
      num = self._list[-1] + 1
      if n < num:
          return
      num2 = num**2
      while num2 <= n:
          self._list += _array("L", self._primerange(num, num2))
          num, num2 = num2, num2**2
      # Merge the sieves
      self._list += _array("L", self._primerange(num, n + 1))
  
imports: from bisect import bisect, bisect_left
  from itertools import count
  from array import array
  from sympy.core.function import Function
  from sympy.core.random import randint
  from sympy.core.singleton import S
  from sympy.external.gmpy import sqrt
  from .primetest import isprime
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 4 for calling the Sieve obj's underlying member method code with example usage: obj.extend(n) without return types