From 9417091dabf9d8e9ebec078942a2fbba0966e42f Mon Sep 17 00:00:00 2001 From: Sanders Lin <45224617+SandersLin@users.noreply.github.com> Date: Wed, 13 Feb 2019 18:02:32 +0800 Subject: [PATCH] Update sol1.py (#643) small off by one error. Boundary condition: if len(number) =13 , we would need to check exactly 1 combination, namely number itself. However for i in range(len(number)-13): will iterate 0 times. --- project_euler/problem_08/sol1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project_euler/problem_08/sol1.py b/project_euler/problem_08/sol1.py index fb5ed25bf..817fd3f87 100644 --- a/project_euler/problem_08/sol1.py +++ b/project_euler/problem_08/sol1.py @@ -2,7 +2,7 @@ import sys def main(): LargestProduct = -sys.maxsize-1 number=input().strip() - for i in range(len(number)-13): + for i in range(len(number)-12): product=1 for j in range(13): product *= int(number[i+j])