Quote:
Originally Posted by henryzz
I think your best bet might be to modify mtsieve adding a fixed k sieve with k being a gmp number.
Your runtime might be dominated though by calculating k % p as that is a very large k. Whatever you do I don't think it is going to be overly fast.
http://www.mersenneforum.org/rogue/mtsieve.html

Thank you for pointing out mtsieve. (I did not know about this before :( )
There is something called modular exponentiation which will calculate k%p very fast.
Calculating k%p will take very little time per prime.
Addendum: Looks like srsieve is not implemented yet. So this will not help.