Thanks for pointing that out. I’ll take a look when I get time, but it might not be quickly since we have the bootcamp and upgrade work to do on the track, as well as other maintenance.
The instructions are a bit vague and could be easily misinterpreted. The statement ‘do not use division or remainder operations’ should be understood as ‘do not use division or remainder operations for marking the numbers.’ However, this isn’t mentioned explicitly, so people might mistakenly assume they shouldn’t use these operations anywhere in the algorithm, even though using them for other calculations is allowed.
Also, on completing the exercise in the Python track it suggests you have advanced your knowledge of sets, but that’s not necessarily the case since sets are not mentioned in the instructions nor required by common solutions. If that’s the intention, the Python track addendum should probably hint at the special advantages of using sets for a Python solution. However as the narrative suggests that the aim is to use as much CPU time as possible and the Sieve is inherently not the most efficient way to generate the primes I don’t find it in the spirit of the narrative to optimise the solutions for performance in any case!
Mainly that (since that was the main issue brought up in this thread) - but I would also welcome any other clarifications that would help and or challenge Pythonistas in particular.
Honestly, I can’t propose anything Python-specific, as I don’t have sufficient knowledge of the language. My only suggestion for now would be a modification of the instructions. I would change the note to:
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 (using either division or remainder operations).
The tests don't check that you've implemented the algorithm, only that you've come up with the correct list of primes.
The wording here is very precise, so if you want to adopt parts of it for the Python track, any modifications should be made carefully. Alternatively, we can discuss potential changes to the current instructions in a new thread.
We might as well leave the “(using either division or remainder operations)” out since there are also other ways to check for divisibility (bit-shift).
Let’s go ahead with that discussion in a separate thread. This exercise was featured during 48in24 so maintainers worked on updating the documentation beforehand. However, they had to stop early to make sure tracks had time to get the changes synced. This time, we don’t have a deadline to contend with.
I thought it better to point out that using said operator doesn’t really get you anywhere performance-wise, and its counter to the instructions rather than omit it from the article.