Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: exercism/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: ellnix/exercism-rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refs/heads/problem-specifications-sync
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Mar 23, 2025

  1. Sync exercise files with problem-specifications

    No changes in tests, the updates in the instructions do not require any
    rust-specific appends as far as I can see.
    ellnix committed Mar 23, 2025
    Copy the full SHA
    062dafe View commit details
2 changes: 1 addition & 1 deletion bin/checkout_pinned_problem_specifications_commit.sh
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ set -euo pipefail

cd "$(git rev-parse --show-toplevel)"

PINNED_COMMIT_HASH="47b3bb2a1c88bf93d540916477a3b71ff94e9964"
PINNED_COMMIT_HASH="1799950ecdc8273426de6426a5bed8c360c9f2c7"

dir="$(./bin/get_problem_specifications_dir.sh)"

2 changes: 1 addition & 1 deletion exercises/practice/affine-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ Where:

- `i` is the letter's index from `0` to the length of the alphabet - 1.
- `m` is the length of the alphabet.
For the Roman alphabet `m` is `26`.
For the Latin alphabet `m` is `26`.
- `a` and `b` are integers which make up the encryption key.

Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
11 changes: 6 additions & 5 deletions exercises/practice/saddle-points/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -13,11 +13,12 @@ Or it might have one, or even several.
Here is a grid that has exactly one candidate tree.

```text
1 2 3 4
|-----------
1 | 9 8 7 8
2 | 5 3 2 4 <--- potential tree house at row 2, column 1, for tree with height 5
3 | 6 6 7 1
1 2 3 4
|-----------
1 | 9 8 7 8
→ 2 |[5] 3 2 4
3 | 6 6 7 1
```

- Row 2 has values 5, 3, 2, and 4. The largest value is 5.
75 changes: 67 additions & 8 deletions exercises/practice/sieve/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -6,37 +6,96 @@ A prime number is a number larger than 1 that is only divisible by 1 and itself.
For example, 2, 3, 5, 7, 11, and 13 are prime numbers.
By contrast, 6 is _not_ a prime number as it not only divisible by 1 and itself, but also by 2 and 3.

To use the Sieve of Eratosthenes, you first create a list of all the numbers between 2 and your given number.
Then you repeat the following steps:
To use the Sieve of Eratosthenes, first, write out all the numbers from 2 up to and including your given number.
Then, follow these steps:

1. Find the next unmarked number in your list (skipping over marked numbers).
1. Find the next unmarked number (skipping over marked numbers).
This is a prime number.
2. Mark all the multiples of that prime number as **not** prime.

You keep repeating these steps until you've gone through every number in your list.
Repeat the steps until you've gone through every number.
At the end, all the unmarked numbers are prime.

~~~~exercism/note
The tests don't check that you've implemented the algorithm, only that you've come up with the correct list of primes.
To check you are implementing the Sieve correctly, a good first test is to check that you do not use division or remainder operations.
The Sieve of Eratosthenes marks off multiples of each prime using addition (repeatedly adding the prime) or multiplication (directly computing its multiples), rather than checking each number for divisibility.
The tests don't check that you've implemented the algorithm, only that you've come up with the correct primes.
~~~~

## Example

Let's say you're finding the primes less than or equal to 10.

- List out 2, 3, 4, 5, 6, 7, 8, 9, 10, leaving them all unmarked.
- Write out 2, 3, 4, 5, 6, 7, 8, 9, 10, leaving them all unmarked.

```text
2 3 4 5 6 7 8 9 10
```

- 2 is unmarked and is therefore a prime.
Mark 4, 6, 8 and 10 as "not prime".

```text
2 3 [4] 5 [6] 7 [8] 9 [10]
```

- 3 is unmarked and is therefore a prime.
Mark 6 and 9 as not prime _(marking 6 is optional - as it's already been marked)_.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 4 is marked as "not prime", so we skip over it.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 5 is unmarked and is therefore a prime.
Mark 10 as not prime _(optional - as it's already been marked)_.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 6 is marked as "not prime", so we skip over it.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 7 is unmarked and is therefore a prime.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 8 is marked as "not prime", so we skip over it.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 9 is marked as "not prime", so we skip over it.

```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

- 10 is marked as "not prime", so we stop as there are no more numbers to check.

You've examined all numbers and found 2, 3, 5, and 7 are still unmarked, which means they're the primes less than or equal to 10.
```text
2 3 [4] 5 [6] 7 [8] [9] [10]
```

You've examined all the numbers and found that 2, 3, 5, and 7 are still unmarked, meaning they're the primes less than or equal to 10.