Last active
December 29, 2015 12:19
-
-
Save LectomT/7669967 to your computer and use it in GitHub Desktop.
10001번째 소수. 체크로직을 이용.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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