Skip to content

[Hacker Rank]: Project Euler #1: Multiples of 3 and 5. Documentation … #14

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

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @link Problem definition [[docs/hackerrank/projecteuler/euler001.md]]

namespace algorithm_exercises_csharp.hackerrank.prohecteuler;

using System.Diagnostics.CodeAnalysis;
Expand Down
Empty file removed docs/.gitkeep
Empty file.
49 changes: 49 additions & 0 deletions docs/hackerrank/projecteuler/euler001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# [Multiples of 3 and 5](https://www.hackerrank.com/contests/projecteuler/challenges/euler001)

- Difficulty: #easy
- Category: #ProjectEuler+

If we list all the natural numbers below $ 10 $ that are multiples of
$ 3 $ or $ 5 $, we get $ 3, 5, 6 $ and $ 9 $.
The sum of these multiples
is $ 23 $.

Find the sum of all the multiples of $ 3 $ or $ 5 $ below $ N $.

## Input Format

First line contains $ T $ that denotes the number of test cases.
This is followed by $ T $ lines, each containing an integer, $ N $.

## Constraints

- 1 $ \leq T \leq 10^5 $
- 1 $ \leq N \leq 10^9 $

## Output Format

For each test case, print an integer that denotes the sum of all the multiples
of $ 3 $ or $ 5 $ below $ N $.

## Sample Input 0

```text
2
10
100
```

## Sample Output 0

```text
23
2318
```

## Explanation 0

For $ N = 10 $, if we list all the natural numbers below $ 10 $ that are
multiples of $ 3 $ or $ 5 $, we get $ 3, 5, 6 $ and $ 9 $.
The sum of these multiples is $ 23 $.

Similarly for $ N = 100 $, we get $ 2318 $.
Loading