summaryrefslogtreecommitdiff
path: root/Problem50.py
blob: 0bae09969cb7677f23b4672de338ce8829648759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)