Fixed-K sieve

A fixed-K sieve is a type of sieve application for Proth or Riesel numbers, of the form K*bN+/-1. It is best suited to testing ranges with many N's and relatively few K's. Sieving either more K's or more N's decreases the speed of a fixed-K sieve. However, sieving a range of N's at once is always faster than dividing the range into parts to be sieved separately. Whether this is also true for K's depends on the sieve algorithm.

Given we are testing numbers of the format:

K*bN-1 = 0 (mod P)

If K is fixed, we want to find an N where P divides the entire number. To do this, we rearrange the equation:

K*bN = 1 (mod P)

bN = 1/K (mod P)

N = logb(1/K) (mod P)

Here we have two relatively difficult problems (as compared to a fixed-N sieve.) The first, computing the value of 1/K (mod P) is called the modular multiplicative inverse. Once that value is found, a discrete logarithm must be computed to find a value of N where P is a factor of the original number.

The same procedure applies for numbers of the form K*bN+1 = 0 (mod P), except that 1/K must be negated before computing the discrete logarithm. (-(1/K) (mod P) = P-(1/K) (mod P))