Skip to content

Create 001 #12288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 25 additions & 0 deletions project_euler/problem_001/001
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# solved #001
"""
Project Euler Problem 1: https://projecteuler.net/problem=1

Multiples of 3 or 5

"""

def solution(n: int = 1000) -> int:
"""
For number i in 1 to 1000 we take modulus of 3 and 5 with each number and when any of their value is zero we add that number to sum_count varialbe.

"""
n = 1000
sum_count = 0
for i in range(1,n+1):
if i%3==0 or i%5==0:
sum_count += i

return sum_count


if __name__ == "__main__":
print(f"{solution() = }")