File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
project_euler/problem_009 Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,16 @@ def solution() -> int:
2525 2. a**2 + b**2 = c**2
2626 3. a + b + c = 1000
2727
28- # The code below has been commented due to slow execution affecting Travis.
29- # >>> solution()
30- # 31875000
28+ >>> solution()
29+ 31875000
3130 """
3231
3332 for a in range (300 ):
34- for b in range (400 ):
35- for c in range (500 ):
36- if a < b < c :
33+ for b in range (a + 1 , 400 ):
34+ for c in range (b + 1 , 500 ):
35+ if ( a + b + c ) == 1000 :
3736 if (a ** 2 ) + (b ** 2 ) == (c ** 2 ):
38- if (a + b + c ) == 1000 :
39- return a * b * c
37+ return a * b * c
4038
4139
4240def solution_fast () -> int :
@@ -47,9 +45,8 @@ def solution_fast() -> int:
4745 2. a**2 + b**2 = c**2
4846 3. a + b + c = 1000
4947
50- # The code below has been commented due to slow execution affecting Travis.
51- # >>> solution_fast()
52- # 31875000
48+ >>> solution_fast()
49+ 31875000
5350 """
5451
5552 for a in range (300 ):
You can’t perform that action at this time.
0 commit comments