Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterating primes in descending order #34

Open
samuelpilz opened this issue Sep 9, 2021 · 1 comment
Open

Iterating primes in descending order #34

samuelpilz opened this issue Sep 9, 2021 · 1 comment

Comments

@samuelpilz
Copy link

samuelpilz commented Sep 9, 2021

Hi, I have the usecase where I need to iterate primes of a sieve in descending order starting from some upper bound.

This example prints all primes below 100 in descending order

for prime in sieve.primes_from_desc(100) {
  println!("{}", p);
}

Is a function like this possible?

@cuviper
Copy link
Collaborator

cuviper commented Sep 9, 2021

It should be possible, yes. It could be a new iterator type, or we could try making SievePrimes doubled-ended, although that would require more complicated state.

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

No branches or pull requests

2 participants