Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. n = 10 ** 6 + 3 * 10 ** 5
  2. isPrime = [True] * (n + 1)
  3. isPrime[0] = isPrime[1] = False
  4.  
  5. p = 2
  6. while p * p <= n:
  7.   if isPrime[p]:
  8.     for i in range(p * p, n+1, p):
  9.       isPrime[i] = False
  10.   p += 1
  11.  
  12. k = int(input())
  13. p = 2
  14. while k > 0:
  15.   if isPrime[p]:
  16.     x = p
  17.     k -= 1
  18.   p += 1
  19. print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement