'Grow the sieve to cover all primes <= n (a real number).
Examples
>>> from sympy import sieve
>>> sieve._reset() # this line for doctest only
>>> sieve.extend(30)
>>> sieve[10] == 29
True'

def extend(self, n):

    n = int(n)
    if (n <= self._list[(-1)]):
        return
    maxbase = (int((n ** 0.5)) + 1)
    self.extend(maxbase)
    begin = (self._list[(-1)] + 1)
    newsieve = _arange(begin, (n + 1))
    for p in self.primerange(2, maxbase):
        startindex = ((- begin) % p)
        for i in range(startindex, len(newsieve), p):
            newsieve[i] = 0
    self._list += _array('l', [x for x in newsieve if x])
