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:
break
conseq = primes[start:end] conseq = primes[start:end]
s = sum(conseq) s = sum(conseq)
if len(conseq) > 1 and s in primes[start:]: if s >= 1000000:
return maxp
if s in primes[start + maxlen:]:
maxlen = end - start maxlen = end - start
maxp = s maxp = s
print maxp
#print '%s = %d' % (' + '.join(map(str, primes[start:end])), 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