Write a function, which checks a number, if it's a prime.
In another function you collect primes, until you have the number of primes you want to have.
If you make the easiest implementation, it takes more time to check primes.
In another function you collect primes, until you have the number of primes you want to have.
from itertools import count def is_prime(number): """Your implementation""" return True def get_primes(n): primes = [] while len(primes) < n: for number in count(): if is_prime(number): primes.append(number) return primesThe function to check the prime can also taken from other libraries.
If you make the easiest implementation, it takes more time to check primes.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!