Testing Robinson numbers for primality

The reader is assumed to be familiar with searches for Proth primes and related forms using software such as Proth.exe, Newpgen.exe, Primeform.exe, Prp.exe, Winbitwin.exe, Titanix,exe, etc.

There are a number of ways of testing a positive integer p for primality. These include :

- a full sieve to the root of p;
- variations of the p- 1 methods developed by Brillhart, Morrison and Selfridge, based on earlier results by Lucas, Proth and Pocklington, wherein p- 1 is factored completely or partially and the factors used to test for pseudoprimality.
- variations of the p+1 methods developed by Brillhart, Morrison and Selfridge from earlier ideas by Lucas and Lehmer.
- combinations of both of the previous methods.
- generic primality testing algorithms such as ECPP (Elliptic Curve Primality Proving), by Atkin and Morain (Titanix.exe is an implementation of this), and APR-CL (Adleman, Pomerance, Rumely, Cohen , Lenstra).

In practice, whether for finding Proth primes, primes in arithmetic progression, Cunningham chains, etc., interest will usually be in searching across large ranges of numbers of the form k*2^{n} +1, where the p- 1 Proth test can be used. The initial search space (i.e. the entire set of numbers to be considered) is substantially restricted by using a partial sieve to a manageable limit, as it done by both Proth.exe and Newpgen.exe. These programs can be used to build lists of combinations k & n which may then be tested for pseudoprimality using Prp.exe and then primality using Proth.exe or Primeform.exe. Note that the generic algorithms are not equipped to cope with numbers of the sizes typically considered here.

I am interested in the typical number of pseudoprimality / primality tests that have to be carried out across a close range (I mean by this that values of n are approximately equal) in order to locate a prime. In particular, in searching for Keller primes, I am interested in testing a fixed and limited number of k values over given n ranges. Since Newpgen.exe is not suited to this, the alternative is to generate quickly an initial test set using a very brief sieve and then passing the output of this to Proth.exe, using the "Factors only" preference and with a fixed manual sieve limit. The idea of a fixed limit sieve is important in what follows.

Now for some theory : It is widely known (and I won't give references) that p (x), the number of primes less than or equal to x, is approximately equal to and that the likelihood that x is prime is approximately . But what if x (or p, since we are interested in primes) has already survived a sieve to a limit q ? Now, it is obvious that the proportion of integers surviving a sieve to q is s(q) = . If p has survived a sieve to q, then the likelihood that p is a prime is therefore , or where t(q) = , and the expected number of tests required in order to obtain a prime is the inverse of this. A classical result by Mertens implies that t(q) ® eg .log(q) as q ® ¥ , where g is Euler's constant, and so the value of t(q) rises logarithmically. The two tables below comparative values between the calculated value and the estimated value for a variety of key limits.

q |
t(q) (calculated) |
t(q) (estimated) |

10 |
4.375 |
4.101 |

10 |
8.31135737892 |
8.202 |

10 |
12.3509756739 |
12.3032 |

10 |
16.4244896322 |
16.4043 |

10 |
20.5115928252 |
20.50535 |

10 |
24.6073829476 |
24.6064 |

10 |
28.7077703609 |
28.7075 |

10 |
32.808698609 |
32.8086 |

and

q |
t(q) (calculated) |
t(q) (estimated) |

2 |
2 |
1.2345 |

2 |
3 |
2.469 |

2 |
4.375 |
3.7036 |

2 |
5.21354166667 |
4.938 |

2 |
6.54226970908 |
6.173 |

2 |
7.59951458813 |
7.4073 |

2 |
8.78222652931 |
8.642 |

2 |
9.96479475259 |
9.876 |

2 |
11.2037429513 |
11.1109 |

2 |
12.3997465887 |
12.34545 |

2 |
13.6141194455 |
13.58 |

2 |
14.8463264797 |
14.81454 |

2 |
16.0642635225 |
16.049 |

2 |
17.2996827618 |
17.2836 |

2 |
18.5252325284 |
18.5182 |

2 |
19.7576704153 |
19.7527 |

2 |
20.9920980308 |
20.98727 |

2 |
22.2243300099 |
22.1816 |

2 |
23.4592887593 |
23.45636 |

2 |
24.692296376 |
24.6909 |

2 |
25.9266589754 |
25.92545 |

2 |
27.1608713184 |
27.16 |

2 |
28.3950646914 |
28.39454 |

2 |
29.6294155136 |
29.62909 |

2 |
30.864034405 |
30.8636 |

2 |
32.098384759 |
32.09818 |

2 |
33.33284689 |
33.33272 |

Consider p = k*2^{n} + 1. Then log (p) » n*log(2) + log (k), and if k is small in comparison to n, then we can take log (p) » n*log(2). Then the expected number of tests required on numbers surviving a sieve to q (rounding up to nearest integer) is :

q \ n |
10000 |
20000 |
50000 |
100000 |
200000 |

10 |
338 |
676 |
1690 |
3380 |
6759 |

10 |
282 |
564 |
1409 |
2817 |
5634 |

10 |
242 |
483 |
1208 |
2415 |
4829 |

10 |
212 |
423 |
1057 |
2113 |
4226 |