Advertisement
Guest User

Untitled

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