joshibharathiramana
2021-3-30 15:36:55

I was looking around racket repositories to contribute and <https://github.com/racket/racket/wiki/Math-Library-Features#user-content-mathspecial-functions:~:text=math%2Fnumber%2Dtheory,in%2Dprimes|discovered that >in-primes<https://github.com/racket/racket/wiki/Math-Library-Features#user-content-mathspecial-functions:~:text=math%2Fnumber%2Dtheory,in%2Dprimes| is on the todo>. Can someone please explain how in-primes is expected to work?


samth
2021-3-30 15:38:42

It would be a stream that produced each prime, in order of size.


joshibharathiramana
2021-3-30 15:42:18

How would it have to be implemented? Would the priority queue based solution described in this paper suffice? https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf


samth
2021-3-30 15:43:04

There are lots of potential implementations; that seems like it might be fine


soegaard2
2021-3-30 16:30:16

@joshibharathiramana In math/number-theory there is a next-prime function. So one way to do it: (in-primes start) will produce all primes ≥start.

The iterator needs to store a current number and call next-prime to find the next prime.