A simple function that allow to find first N prime numbers:

def primes(n): numbers = set(range(2, n)) for j in range(2, int(np.sqrt(n))): numbers -= set(range(2*j, n, j)) return sorted(list(numbers)) print(primes(n=100))

A simple function that allow to find first N prime numbers:

def primes(n): numbers = set(range(2, n)) for j in range(2, int(np.sqrt(n))): numbers -= set(range(2*j, n, j)) return sorted(list(numbers)) print(primes(n=100))