def sieve_of_eratosthenes(self, n):
    if using_numpy:
        sieve = np.ones((n + 1), dtype=np.int32)
        sieve[:2] = 0
        for i in range(2, (int((n ** 0.5)) + 1)):
            if sieve[i]:
                sieve[(i * 2)::i] = 0
        prime_numbers = np.flatnonzero(sieve)
    else:
        sieve = ([1] * (n + 1))
        sieve[0] = sieve[1] = 0
        for i in range(2, (int((n ** 0.5)) + 1)):
            if (not sieve[i]):
                continue
            for j in range((i * 2), (n + 1), i):
                sieve[j] = 0
        prime_numbers = [i for i in range(2, (n + 1)) if sieve[i]]
    return (sieve, prime_numbers)
def sieve_of_eratosthenes(self, n):
    if using_numpy:
        sieve = np.ones((n + 1), dtype=np.int32)
        sieve[:2] = 0
        for i in range(2, (int((n ** 0.5)) + 1)):
            if sieve[i]:
                sieve[(i * 2)::i] = 0
        prime_numbers = np.flatnonzero(sieve)
    else:
        sieve = ([1] * (n + 1))
        sieve[0] = sieve[1] = 0
        for i in range(2, (int((n ** 0.5)) + 1)):
            if (not sieve[i]):
                continue
            for j in range((i * 2), (n + 1), i):
                sieve[j] = 0
        prime_numbers = [i for i in range(2, (n + 1)) if sieve[i]]
    return (sieve, prime_numbers)