Skip to content

Instantly share code, notes, and snippets.

@LectomT
Last active December 29, 2015 12:19
Show Gist options
  • Save LectomT/7669967 to your computer and use it in GitHub Desktop.
Save LectomT/7669967 to your computer and use it in GitHub Desktop.
10001번째 소수. 체크로직을 이용.
import time
start = time.time()
def is_prime(v):
i = 2
while True:
if (v % i) == 0:
return False
elif (i * i) > v:
return True
i += 1
count_prime = 1
number = 3
while count_prime < 10001:
if (is_prime(number)):
count_prime += 1
number += 1
print number - 1
end = time.time() - start
print str(end) + ' sec'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment