Summary: The current instructions mention in the 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 ‘not use division or remainder operations’ can easily be misinterpreted. Division and remainder operations are allowed in general, but they should be avoided specifically for finding the multiples. Additionally, division and remainder are not the only methods to check for divisibility.
Proposed change:
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 list of primes.
This seems a reasonable change to me. Whether a student’s solution correctly implements the algorithm can be handled better within a mentoring discussion.
My one question is specifying a list of primes in the text might be a problem for tracks that expect the primes in a different structure. ... that you've come up with the correct primes would indicate a group of primes is expected without suggesting a particular structure.
I’ve considered this as well. This is a common issue in Clojure, which I usually resolve with an append file. However, this isn’t just about the structure used when returning the primes — the instructions use the word list multiple times:
To use the Sieve of Eratosthenes, you first create a list of all the numbers between 2 and your given number.
It now instructs to create a list of numbers, mark the non-primes, and return the remaining list. I’ll see if there’s a way to modify the instructions to avoid referencing lists altogether.
I don’t feel like this is necessarily referring to a list structure in a programming language. It’s just describing the algorithm in plain terms, you could do this with pen and paper.
Unfortunately, that’s exactly the problem with the term list. People aren’t aware that it does not refer to a list structure in a language. So they’ll probably misinterpret it as “use lists”, if the language has lists.
In retrospect, i’m not entirely sure how to completely remove the references to lists, or even if it’s worth doing so. If so, we should probably need to standardize the terminology across tracks instead of solving the problem here only to be faced with the exact same problem in other exercises. That’s why i did not bother to mention this issue in the first place. I prefer append files as a quick solution.
Anyway, i’ll take a look at the instructions to see if there’s an easy modification that we can do. Ideas welcome.
Another approach would be to mention in the instructions that the list is a generic term used to describe an ordered collection of items, and has nothing to do with a specific data structure that may exist in the language.
Again, i’d prefer if this is standardized across exercises, instead of just solving it for this exercise alone.
I haven’t changed ‘mark’ to ‘cross’ because too many lines would need updating, and the change doesn’t seem to make much of a difference.
There’s also a detailed example that shows the procedure, so I’ve left the “2 3 4 5 6 …” part out. This would be best included in the example, rather than in the general instructions. The example seems clear to me, though we could argue for showing the result after each step.