diff --git a/Project Euler/Problem 01/sol5.py b/Project Euler/Problem 01/sol5.py index 2cb67d2524e2..3a6d3089db15 100644 --- a/Project Euler/Problem 01/sol5.py +++ b/Project Euler/Problem 01/sol5.py @@ -1,8 +1,7 @@ -a=3 -result=0 -while a=<1000: - if(a%3==0 and a%5==0): - result+=a - elif(a%15==0): - result-=a -print(result) +#!/usr/bin/env python3 + +"""Find the sum of all the multiples of 3 or 5 below 1000.""" + +# https://projecteuler.net/problem=1 + +print(sum(i if 0 in (i % 3, i % 5) else 0 for i in range(1000)))