Commit e3869856 authored by Taddeus Kroes's avatar Taddeus Kroes

Optimized 50

parent 1598cdc8
...@@ -7,15 +7,18 @@ def maxprime(n): ...@@ -7,15 +7,18 @@ def maxprime(n):
for start in xrange(len(primes)): for start in xrange(len(primes)):
for end in xrange(start + maxlen + 1, start + 800): for end in xrange(start + maxlen + 1, start + 800):
if end - start >= maxlen: if end - start < maxlen:
conseq = primes[start:end] break
s = sum(conseq)
if len(conseq) > 1 and s in primes[start:]: conseq = primes[start:end]
maxlen = end - start s = sum(conseq)
maxp = s
print maxp if s >= 1000000:
#print '%s = %d' % (' + '.join(map(str, primes[start:end])), s) return maxp
if s in primes[start + maxlen:]:
maxlen = end - start
maxp = s
return maxp return maxp
......
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