Skip to content

Conversation

@rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Jul 26, 2025

  • The sieve call in nth_prime relies on the upper bound being exclusive. Adjust the comment in _nth_prime_bounds function to match. Demonstration:
for n, p in enumerate(sieve(10**8), start=1):
    l, u = _nth_prime_bounds(n)
    assert l < p < u
  • The spread ratio noted in the comment should be relative to the nth prime rather than n.
>>> l, u = _nth_prime_bounds(688_383)
>>> (u - l) / l
0.0029597587292980792

@bbayles bbayles merged commit e048f12 into more-itertools:master Jul 28, 2025
6 checks passed
@rhettinger rhettinger deleted the nth_prime_comment_typo branch July 28, 2025 15:18
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.

2 participants