Project Euler: problem 8
- by Marijus
n = # some ridiculously large number, omitted
N = [int(i) for i in str(n)]
maxProduct = 0
for i in range(0,len(N)-4):
newProduct = 1
is_cons = 0
for j in range(i,i+4):
if N[j] == N[j+1] - 1:
is_cons += 1
if is_cons == 5:
for j in range(i,i+5):
newProduct *= N[j]
if newProduct > maxProduct:
maxProduct = newProduct
print maxProduct
I've been working on this problem for hours now and I can't get this to work. I've tried doing this algorithm on paper and it works just fine.. Could you give me hints what's wrong ?