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: Return the nth prime number
docstr_tok: ["Return","the","nth","prime","number"]
code: def __getitem__(self, n):
      """Return the nth prime number"""
      if isinstance(n, slice):
          self.extend_to_no(n.stop)
          # Python 2.7 slices have 0 instead of None for start, so
          # we can't default to 1.
          start = n.start if n.start is not None else 0
          if start < 1:
              # sieve[:5] would be empty (starting at -1), let's
              # just be explicit and raise.
              raise IndexError("Sieve indices start at 1.")
          return self._list[start - 1 : n.stop - 1 : n.step]
      else:
          if n < 1:
              # offset is one, so forbid explicit access to sieve[0]
              # (would surprisingly return the last one).
              raise IndexError("Sieve indices start at 1.")
          n = as_int(n)
          self.extend_to_no(n)
          return self._list[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 13 for calling the Sieve obj's underlying member method code with example usage: obj.__getitem__(n) and returns: self, self