From f9099997774e2714c8cbea58731947b2011a478e Mon Sep 17 00:00:00 2001 From: eberjoe Date: Sun, 6 Jan 2019 06:30:43 -0200 Subject: [PATCH] Add 007 --- problem007.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 problem007.py diff --git a/problem007.py b/problem007.py new file mode 100644 index 0000000..405fa64 --- /dev/null +++ b/problem007.py @@ -0,0 +1,20 @@ +# Find the nth prime + +import math + +n = 10001 +k = 0 +i = 1 + +def isPrime(x): + a = int(math.sqrt(x)) + for i in range(2, a+1): + if x%i == 0: + return False + return True + +while k < n: + i += 1 + k += isPrime(i) + +print(i)