primes = [] i = 2 while (len(primes) < 10001): if all(i % p != 0 for p in primes): primes.append(i) i += 1 print(primes[-1])