aboutsummaryrefslogtreecommitdiff
path: root/challenge-146/lubos-kolouch/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-146/lubos-kolouch/python/ch-1.py')
-rw-r--r--challenge-146/lubos-kolouch/python/ch-1.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-146/lubos-kolouch/python/ch-1.py b/challenge-146/lubos-kolouch/python/ch-1.py
new file mode 100644
index 0000000000..3191b3e2e4
--- /dev/null
+++ b/challenge-146/lubos-kolouch/python/ch-1.py
@@ -0,0 +1,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