summaryrefslogtreecommitdiff
path: root/Problem50.py
diff options
context:
space:
mode:
authorJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
committerJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
commit1161f9a034de06a63538e3a9a0b7717098c744d9 (patch)
tree55bb842b2daa4f096eb7916a8d3630426fc1c376 /Problem50.py
Initial CommitHEADmaster
Diffstat (limited to 'Problem50.py')
-rw-r--r--Problem50.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Problem50.py b/Problem50.py
new file mode 100644
index 0000000..0bae099
--- /dev/null
+++ b/Problem50.py
@@ -0,0 +1,18 @@
+def isPrime(n):
+ for x in range(2,int(n/2)+1):
+ if n%x == 0: return False
+ return True
+def nextprime(n):
+ n+=1
+ while isPrime(n) == False:
+ n+=1
+ return n
+maxsum = 0
+primes = []
+for x in {2,5,7,11,13}:
+ sum = 0
+ while sum <1000000:
+ sum += x
+ x = nextprime(x)
+ if isPrime(sum) and (sum > maxsum) and (sum < 1000000): maxsum = sum
+print(maxsum)