Skip to content

Commit 03110d1

Browse files
committed
Add dummy solution to test the script
1 parent f3ceac2 commit 03110d1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

project_euler/problem_001/sol8.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
Project Euler Problem 1: https://projecteuler.net/problem=1
3+
4+
Multiples of 3 and 5
5+
6+
If we list all the natural numbers below 10 that are multiples of 3 or 5,
7+
we get 3, 5, 6 and 9. The sum of these multiples is 23.
8+
9+
Find the sum of all the multiples of 3 or 5 below 1000.
10+
"""
11+
12+
13+
def solution(n: int = 1000) -> int:
14+
"""
15+
Returns the sum of all the multiples of 3 or 5 below n.
16+
17+
>>> solution(3)
18+
0
19+
>>> solution(4)
20+
3
21+
>>> solution(10)
22+
23
23+
>>> solution(600)
24+
83700
25+
"""
26+
27+
result = 0
28+
for i in range(n):
29+
if i % 3 == 0:
30+
result += i
31+
elif i % 5 == 0:
32+
result += i
33+
return result
34+
35+
36+
if __name__ == "__main__":
37+
print(f"{solution() = }")

0 commit comments

Comments
 (0)