Commit acdb419a authored by Taddeus Kroes's avatar Taddeus Kroes

Solved 50

parent 1a8b5ee2
#!/usr/bin/env python
from math import sqrt
from utils import primes_until
def maxprime(n):
primes = list(primes_until(n))
maxp = maxlen = 2
for start in xrange(len(primes)):
for end in xrange(start + maxlen + 1, start + 800):
if end - start >= maxlen:
conseq = primes[start:end]
s = sum(conseq)
if len(conseq) > 1 and s in primes[start:]:
maxlen = end - start
maxp = s
print maxp
#print '%s = %d' % (' + '.join(map(str, primes[start:end])), s)
return maxp
print maxprime(1000000)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment