Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions project_euler/problem_009/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ def solution() -> int:
2. a**2 + b**2 = c**2
3. a + b + c = 1000

# The code below has been commented due to slow execution affecting Travis.
# >>> solution()
# 31875000
>>> solution()
31875000
"""

for a in range(300):
for b in range(400):
for c in range(500):
if a < b < c:
for b in range(a + 1, 400):
for c in range(b + 1, 500):
if (a + b + c) == 1000:
if (a ** 2) + (b ** 2) == (c ** 2):
if (a + b + c) == 1000:
return a * b * c
return a * b * c


def solution_fast() -> int:
Expand All @@ -47,9 +45,8 @@ def solution_fast() -> int:
2. a**2 + b**2 = c**2
3. a + b + c = 1000

# The code below has been commented due to slow execution affecting Travis.
# >>> solution_fast()
# 31875000
>>> solution_fast()
31875000
"""

for a in range(300):
Expand Down