Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssokolowskisebastian/ec8b707c8af4d0c90a5339b27afa86b0 to your computer and use it in GitHub Desktop.
Save ssokolowskisebastian/ec8b707c8af4d0c90a5339b27afa86b0 to your computer and use it in GitHub Desktop.
import time
start_time = time.time()
def get_primes(n):
for i in range(2, n):
for j in range(2, int(i**0.5)+1):
if i % j == 0:
break
else:
yield i
def solution(n):
for i, j in enumerate(get_primes(100*n)):
if i == n:
return j
print(solution(10000))
print("--- %s seconds ---" % (time.time() - start_time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment