Skip to content

✨ Quality: Acknowledge that the Sieve of Eratosthenes implementation is "unfaithful"#1154

Open
andoan16 wants to merge 3 commits intosource-academy:masterfrom
andoan16:contribai/improve/quality/acknowledge-that-the-sieve-of-eratosthen
Open

✨ Quality: Acknowledge that the Sieve of Eratosthenes implementation is "unfaithful"#1154
andoan16 wants to merge 3 commits intosource-academy:masterfrom
andoan16:contribai/improve/quality/acknowledge-that-the-sieve-of-eratosthen

Conversation

@andoan16
Copy link
Copy Markdown

Problem

The current text in section 3.5.2 claims that the stream-based algorithm faithfully represents the Sieve of Eratosthenes. According to the referenced paper "The Genuine Sieve of Eratosthenes" (Melissa E. O'Neill, Journal of Functional Programming, 2009), this is incorrect. The algorithm presented is actually a trial division sieve, not the genuine Sieve of Eratosthenes. The text needs to be updated to reflect this, adding a note or modifying the existing description to acknowledge that while the algorithm is elegant and produces correct results, it is not a faithful representation of the original sieve algorithm.

Severity: medium
File: xml/chapter3/section5/subsection2.xml

Solution

The current text in section 3.5.2 claims that the stream-based algorithm faithfully represents the Sieve of Eratosthenes. According to the referenced paper "The Genuine Sieve of Eratosthenes" (Melissa E. O'Neill, Journal of Functional Programming, 2009), this is incorrect. The algorithm presented is actually a trial division sieve, not the genuine Sieve of Eratosthenes. The text needs to be updated to reflect this, adding a note or modifying the existing description to acknowledge that while the algorithm is elegant and produces correct results, it is not a faithful representation of the original sieve algorithm.

Changes

  • xml/chapter3/section5/subsection2.xml (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Closes #1115

…s "unfaithful"

The current text in section 3.5.2 claims that the stream-based algorithm faithfully represents the Sieve of Eratosthenes. According to the referenced paper "The Genuine Sieve of Eratosthenes" (Melissa E. O'Neill, Journal of Functional Programming, 2009), this is incorrect. The algorithm presented is actually a trial division sieve, not the genuine Sieve of Eratosthenes. The text needs to be updated to reflect this, adding a note or modifying the existing description to acknowledge that while the algorithm is elegant and produces correct results, it is not a faithful representation of the original sieve algorithm.

Affected files: subsection2.xml

Signed-off-by: andoan16 <33853760+andoan16@users.noreply.github.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a footnote to clarify that the algorithm described is a trial division sieve rather than the genuine Sieve of Eratosthenes, citing research by Melissa E. O'Neill. The review feedback suggests moving the footnote to follow the term it clarifies for better readability and structural consistency.

Comment thread xml/chapter3/section5/subsection2.xml Outdated
numbers, using a method known as the
<INDEX>prime number(s)<SUBINDEX>Eratosthenes<APOS/>s sieve for</SUBINDEX></INDEX>
<INDEX>sieve of Eratosthenes</INDEX>
<FOOTNOTE>This is not actually the Sieve of Eratosthenes, but rather a trial division sieve. The genuine Sieve of Eratosthenes marks off multiples of each prime starting from the prime's square, whereas this algorithm tests each candidate number by dividing it by all previously found primes. See Melissa E. O'Neill, <QUOTE>The Genuine Sieve of Eratosthenes,</QUOTE> <EM>Journal of Functional Programming</EM>, 2009.</FOOTNOTE>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The placement of this footnote is unconventional. For better readability, a footnote should typically be placed immediately after the term it clarifies, not before.

I recommend moving this <FOOTNOTE> to be after </EM> on line 236. The structure would then look like this:

...
    <EM>sieve of
    Eratosthenes</EM><FOOTNOTE>This is not actually the Sieve of Eratosthenes...</FOOTNOTE>.<FOOTNOTE>Eratosthenes, ...</FOOTNOTE>
...

This will correctly associate the footnote with the term "sieve of Eratosthenes".

@RichDom2185 RichDom2185 requested a review from martin-henz March 28, 2026 18:45
Copy link
Copy Markdown
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: While we are open to entirely AI-generated PRs, please indicate as such clearly. Don't just make us infer it from the branch name.

Comment thread xml/chapter3/section5/subsection2.xml Outdated
numbers, using a method known as the
<INDEX>prime number(s)<SUBINDEX>Eratosthenes<APOS/>s sieve for</SUBINDEX></INDEX>
<INDEX>sieve of Eratosthenes</INDEX>
<FOOTNOTE>This is not actually the Sieve of Eratosthenes, but rather a trial division sieve. The genuine Sieve of Eratosthenes marks off multiples of each prime starting from the prime's square, whereas this algorithm tests each candidate number by dividing it by all previously found primes. See Melissa E. O'Neill, <QUOTE>The Genuine Sieve of Eratosthenes,</QUOTE> <EM>Journal of Functional Programming</EM>, 2009.</FOOTNOTE>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Addressed this feedback in commit fix: address review feedback — Please reformat it.. Thanks for the review!

Signed-off-by: andoan16 <33853760+andoan16@users.noreply.github.com>
Signed-off-by: andoan16 <33853760+andoan16@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sieve of Eratosthenes is "unfaithful"

2 participants