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: Generate all prime numbers in the range (a, b).
  
  Parameters
  ==========
  
  a, b : positive integers assuming the following conditions
          * a is an even number
          * 2 < self._list[-1] < a < b < nextprime(self._list[-1])**2
  
  Yields
  ======
  
  p (int): prime numbers such that ``a < p < b``
  
  Examples
  ========
  
  >>> from sympy.ntheory.generate import Sieve
  >>> s = Sieve()
  >>> s._list[-1]
  13
  >>> list(s._primerange(18, 31))
  [19, 23, 29]
docstr_tok: ["Generate","all","prime","numbers","in","the","range","(","a",",","b",")",".","Parameters","==========","a",",","b",":","positive","integers","assuming","the","following","conditions","*","a","is","an","even","number","*","2","<","self._list","[","-1","]","<","a","<","b","<","nextprime","(","self._list","[","-1","]",")","*","*","2","Yields","======","p","(","int",")",":","prime","numbers","such","that","``","a","<","p","<","b","``","Examples","========",">",">",">","from","sympy.ntheory.generate","import","Sieve",">",">",">","s","=","Sieve","(",")",">",">",">","s._list","[","-1","]","13",">",">",">","list","(","s._primerange","(","18",",","31",")",")","[","19",",","23",",","29","]"]
code: def _primerange(self, a, b):
      """Generate all prime numbers in the range (a, b).
  
      Parameters
      ==========
  
      a, b : positive integers assuming the following conditions
              * a is an even number
              * 2 < self._list[-1] < a < b < nextprime(self._list[-1])**2
  
      Yields
      ======
  
      p (int): prime numbers such that ``a < p < b``
  
      Examples
      ========
  
      >>> from sympy.ntheory.generate import Sieve
      >>> s = Sieve()
      >>> s._list[-1]
      13
      >>> list(s._primerange(18, 31))
      [19, 23, 29]
  
      """
      if b % 2:
          b -= 1
      while a < b:
          block_size = min(self.sieve_interval, (b - a) // 2)
          # Create the list such that block[x] iff (a + 2x + 1) is prime.
          # Note that even numbers are not considered here.
          block = [True] * block_size
          for p in self._list[
              1 : bisect(self._list, sqrt(a + 2 * block_size + 1))
          ]:
              for t in range((-(a + 1 + p) // 2) % p, block_size, p):
                  block[t] = False
          for idx, p in enumerate(block):
              if p:
                  yield a + 2 * idx + 1
          a += 2 * block_size
  
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 5 for calling the Sieve obj's underlying member method code with example usage: obj._primerange(a, b) without return types