aboutsummaryrefslogtreecommitdiff
path: root/challenge-146/lubos-kolouch/python/ch-1.py
blob: 3191b3e2e41e7cbfa6880af6ef6f08443dc4b3d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def nth_prime(n):
    primes = [2]
    i = 3
    while len(primes) < n:
        if all(i % p > 0 for p in primes):
            primes.append(i)
        i += 2
    return primes[-1]


print(nth_prime(10001))  # Output: 104743