Writing out the first six prime numbers, we get 2, 3, 5, 7, 11, and 13. Obviously, the 6th prime is 13.
What is the 10001st prime number?
from math import * def Simple (n): if n < 2: return False if n == 2: return True limit = sqrt(n) div = 2 while div <= limit: if n % div == 0: return False div += 1 return True ind = 0 j = 0 numbers = [i for i in range (13, 10000000)] while ind <= 10001: if Simple(numbers[j]) and ind <= 10001: print (numbers[j]) ind += 1 j += 1
simplenumbers[].append
- Akina