-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheuler050.py
More file actions
31 lines (29 loc) · 758 Bytes
/
euler050.py
File metadata and controls
31 lines (29 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 26 15:47:54 2018
@author: edwin
"""
def main(cap):
import trialDivision
primeList = []
for i in range(1,cap):
if trialDivision.main(i):
primeList.append(i)
sumList = []
total = 0
sumList.append(0)
for j in primeList:
total = total + j
sumList.append(total)
maxChain = 0
maxPrime = 0
for k in range(0,len(sumList)):
for l in range(maxChain+1,k+1):
if (sumList[k] - sumList[k-l])>cap:
break
if (trialDivision.main(sumList[k] - sumList[k-l])):
maxChain = l
maxPrime = sumList[k] - sumList[k-l]
print(maxChain)
print(maxPrime)