This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Strong Pseudoprimes to Twelve Prime Bases

Jonathan Sorenson Department of Computer Science and Software Engineering, Butler University sorenson@butler.edu  and  Jonathan Webster Department of Mathematics and Actuarial Science, Butler University jewebste@butler.edu
(Date: August 2, 2025)
Abstract.

Let ψm\psi_{m} be the smallest strong pseudoprime to the first mm prime bases. This value is known for 1m111\leq m\leq 11. We extend this by finding ψ12\psi_{12} and ψ13\psi_{13}. We also present an algorithm to find all integers nBn\leq B that are strong pseudoprimes to the first mm prime bases; with a reasonable heuristic assumption we can show that it takes at most B2/3+o(1)B^{2/3+o(1)} time.

2010 Mathematics Subject Classification:
Primary 11Y16, 11Y16; Secondary 11A41, 68W40, 68W10
This work was supported in part by a grant from the Holcomb Awards Committee. We thank Frank Levinson for his generous support of Butler University’s cluster supercomputer, Big Dawg. We would also like to thank Andrew Shallue for his feedback on a draft of this paper, and Paul Pollack for his help with some details regarding an earlier proof approach to the running time bound for λ\lambda-sieving.

1. Introduction

Fermat’s Little Theorem states that if nn is prime and gcd(a,n)=1\gcd(a,n)=1, then

an11(modn).a^{n-1}\equiv 1\pmod{n}.

A composite number for which this congruence holds is called a pseudoprime to the base aa. We can restate Fermat’s Little Theorem by algebraically factoring (repeatedly) the difference of squares that arises in an11a^{n-1}-1. In which case, if nn is an odd prime, writing n1=2sdn-1=2^{s}d with dd odd, and gcd(a,n)=1\gcd(a,n)=1, then either

ad1(modn)a^{d}\equiv 1\pmod{n}

or

a2kd1(modn)a^{2^{k}d}\equiv-1\pmod{n}

for some integer kk with 0k<s0\leq k<s. If a composite nn satisfies the above, we call nn a strong pseudoprime to the base aa. Unlike Carmichael numbers, which are pseudoprimes to all bases, there do not exist composite numbers that are strong pseudoprimes to all bases. This fact forms the basis of the Miller-Rabin probabilistic primality test [13]. Define ψm\psi_{m} to be the smallest integer that is a strong pseudoprime to the first mm prime bases. (See A014233 at oeis.org.)

The problem of finding strong pseudoprimes has a long history. Pomerance, Selfridge, and Wagstaff [12] computed ψm\psi_{m} for m=2,3,m=2,3, and 44. Jaeschke [7] computed ψm\psi_{m} for m=5,6,7,m=5,6,7, and 88. By looking at a narrow class of numbers, Zhang [18] gave upper bounds on ψm\psi_{m} for 9m199\leq m\leq 19. Recently, Jian and Deng [8] verified some of Zhang’s conjectures and computed ψm\psi_{m} for m=9,10,m=9,10, and 1111. We continue in this effort with the following.

Theorem 1.1.
ψ12\displaystyle\psi_{12} =3186 65857 83403 11511 67461.\displaystyle=3186\ 65857\ 83403\ 11511\ 67461.
ψ13\displaystyle\psi_{13} =33170 44064 67988 73859 61981.\displaystyle=33170\ 44064\ 67988\ 73859\ 61981.

We also verified Jian and Deng’s work in finding ψ9=ψ10=ψ11\psi_{9}=\psi_{10}=\psi_{11}. Note that the ERH implies ψmexp(m/2)\psi_{m}\geq\exp(\sqrt{m/2}), if ψm\psi_{m} exists [1].

The proof of our theorem relies primarily on running an improved algorithm for finding strong pseudoprimes:

Theorem 1.2.

Given a bound B>0B>0 and an integer m>0m>0 that grows with BB, there is an algorithm to find all integers B\leq B that are products of exactly two primes and are strong pseudoprimes to the first mm prime bases using at most B2/3+o(1)B^{2/3+o(1)} arithmetic operations.

We have a heuristic argument extending this B2/3+o(1)B^{2/3+o(1)} running time bound to integers with an arbitrary number of prime divisors. This result is an improvement over a heuristic O(B9/11)O(B^{9/11}) from [2]. Our algorithm uses the work of Jian and Deng as a starting point, and our specific improvements are these:

  • We applied the results in Bleichenbacher’s thesis [2] to speed the computation of GCDs. See §2.2.

  • We applied the space-saving sieve [4, 15] which enabled us to sieve using full prime signature information. See §2.3.

  • We used a simple table of linked-lists indexed by a hash function based on prime signatures. We used this to store small primes by signature for very fast lookup. See §2.4.

  • When it made sense to do so, we parallelized our code and made use of Big Dawg, Butler University’s cluster supercomputer.

Our changes imply that adding more prime bases for a pseudoprime search (that is, making mm larger) speeds up the algorithm.

The rest of this paper is organized as follows. Section 2 contains a description of the algorithm and its theoretical underpinnings. Section 3 contains the proof of the running time. Section 4 contains implementation details.

2. Algorithmic Theory and Overview

To find all nBn\leq B that are strong pseudoprimes to the first mm prime bases, we use some well-known conditions to limit how many such integers nn we need to check. This is outlined in the first subsection below.

We construct all possibilities by generating nn in factored form, n=p1p2pt1ptn=p_{1}p_{2}\ldots p_{t-1}p_{t}, where tt is the number of prime divisors of nn, and pi<pi+1p_{i}<p_{i+1}. It turns out that tt cannot be too big; we only had to test up to t=6t=6. So we wrote separate programs for each possible tt and the case t=2t=2 dominates the running time.

Let k=p1p2pt1k=p_{1}p_{2}\cdots p_{t-1}. Our algorithms generate all candidate kk values, and then for each kk search for possible primes ptp_{t} to match with kk, to form a strong pseudoprime candidate n=kptn=kp_{t}.

For the bound BB, we choose a cutoff value XX. For kXk\leq X, we use a GCD computation to search for possible primes ptp_{t}, if they exist. For k>Xk>X, we use sieving to find possible primes ptp_{t}. Again, we use separate programs for GCDs and for sieving.

Once each nn is formed, we perform a strong pseudoprime test for the first mm prime bases to see if we have, in fact, found what we are looking for.

2.1. Conditions on (Strong) Pseudoprimes

For the purposes of this paper, it suffices to check square-free odd integers. A computation by Dorais and Klyve [3] shows that a pseudoprime to the bases 2 and 3 must be square-free if it is less than 4.410314.4\cdot 10^{31}. Since the values Zhang conjectured as candidates for ψ12\psi_{12} and ψ13\psi_{13} are less than 4.410314.4\cdot 10^{31}, we restrict our search to square-free numbers.

In general, to rule out integers divisible by squares, it suffices to find all Wieferich primes B1/2\leq B^{1/2}, and for each such prime, perform appropriate tests. This can easily be done in well under O(B2/3)O(B^{2/3}) time. See §3.6.1 in [2].

To each prime pp we associate a vector called its signature. Let ν=(a1,a2,,am)\nu=(a_{1},a_{2},\ldots,a_{m}) for aia_{i} distinct positive integers. Then the signature of pp is

σpν=(v(ordp(a1)),v(ordp(a2)),,v(ordp(am))),\sigma_{p}^{\nu}=\left(v(\mbox{ord}_{p}(a_{1})),v(\mbox{ord}_{p}(a_{2})),\ldots,v(\mbox{ord}_{p}(a_{m}))\right),

where vv denotes valuation with respect to 22 and ordp(a)\mbox{ord}_{p}(a) is the multiplicative order of aa modulo pp.

Example 2.1.

Let pp be the prime 151121151121. Then σpν=(3,4,0,4,2,1,2,4)\sigma_{p}^{\nu}=(3,4,0,4,2,1,2,4) if ν=(2,3,5,7,11,13,17,19)\nu=(2,3,5,7,11,13,17,19).

Theorem 2.2 (Proposition 1 in [7]).

Let n=p1ptn=p_{1}\cdots p_{t} with tt distinct primes, ν=(a1,a2,,am)\nu=(a_{1},a_{2},\ldots,a_{m}) with different integers such that piajp_{i}\nmid a_{j} for all 1it1\leq i\leq t and 1jm1\leq j\leq m. Then nn is a strong pseudoprime to each base in ν\nu if and only if n is a pseudoprime to each base in ν\nu and σp1ν==σptν\sigma_{p_{1}}^{\nu}=\cdots=\sigma_{p_{t}}^{\nu}.

If t>2t>2, then this theorem greatly limits the number of candidate kk values we need to check. In the case t=2t=2 the initial sub-product kk is just a single prime, so this theorem does not, at first, appear to help. However, it does play a role in sieving for ptp_{t}. For the rest of this paper, we use ν\nu as the vector containing the first m=11m=11 or 1212 prime numbers.

2.2. Greatest Common Divisors

As above, let k=p1pt1k=p_{1}\cdots p_{t-1}. We explain in this subsection how to find all possible choices for ptp_{t} to form n=kptn=kp_{t} as a strong pseudoprime to the first mm prime bases using a simple GCD computation.

Let bb be one of the aia_{i} from ν\nu. The pseudoprimality condition bkpt11(modkpt)b^{kp_{t}-1}\equiv 1\pmod{kp_{t}} implies that

bkpt1bk(pt1)+k1bk11(modpt),b^{kp_{t}-1}\equiv b^{k(p_{t}-1)+k-1}\equiv b^{k-1}\equiv 1\pmod{p_{t}},

i.e., that ptp_{t} divides bk11b^{k-1}-1. Considering multiple bases, we know that ptp_{t} must divide

gcd(a1k11,a2k11,,amk11).\gcd\left(a_{1}^{k-1}-1,a_{2}^{k-1}-1,\ldots,a_{m}^{k-1}-1\right).

However, since we are concerned with strong pseudoprimes, we can consider only the relevant algebraic factor of bk11b^{k-1}-1. Following Bleichenbacher’s notation [2], let k1=u2dk-1=u2^{d} for uu odd and

h(b,k)={bu1 if v(ordk(b))=0bu2c1+1 if v(ordk(b))=c>0.h(b,k)=\left\{\begin{array}[]{ll}b^{u}-1&\mbox{ if }v(\mbox{ord}_{k}(b))=0\\ b^{u2^{c-1}}+1&\mbox{ if }v(\mbox{ord}_{k}(b))=c>0\end{array}\right..
Theorem 2.3 (Theorem 3.23 of [2]).

A necessary condition for an integer nn of the from n=kptn=kp_{t}, for a given kk with ptp_{t} prime, to be a strong pseudprime to the bases a1,,ama_{1},\ldots,a_{m} is that ptp_{t} divide gcd(h(a1,k),,h(am,k))\gcd(h(a_{1},k),\ldots,h(a_{m},k)).

This theorem allows us to construct the product of all possible ptp_{t} values for a given kk by computing a GCD. To carry this out, we figure out which of the h(ai,k)h(a_{i},k) values would be the smallest, compute that, and then compute the next smallest hh value modulo the smallest, perform a GCD, and repeat until we get an answer k\leq k, or use up all the aia_{i} base values.

Example 2.4.

Let k=151121k=151121, which is prime. We have

v(ordk(2))=3237780+1\displaystyle v(\mbox{ord}_{k}(2))=3\implies 2^{37780}+1 8.189×1011372,\displaystyle\approx 8.189\times 10^{11372},
v(ordk(3))=4375560+1\displaystyle v(\mbox{ord}_{k}(3))=4\implies 3^{75560}+1 1.914×1036051,\displaystyle\approx 1.914\times 10^{36051},
v(ordk(5))=0594451\displaystyle v(\mbox{ord}_{k}(5))=0\implies 5^{9445}-1 5.911×106601.\displaystyle\approx 5.911\times 10^{6601}.

In this case, we would begin the computations with 5944515^{9445}-1 since it is the smallest. We then compute gcd(237780+1mod(594451),594451)=151121\gcd(2^{37780}+1\bmod(5^{9445}-1),5^{9445}-1)=151121. This tells us that any nn of the form 151121pt151121\cdot p_{t} is not a strong pseudoprime to the vector ν=(2,3,5)\nu=(2,3,5).

These computations start off easy as kk is small and progressively get harder (in an essentially linear fashion) as kk grows. As a practical matter, these computations only need to be done once. As an example, [8] found

84 98355 74122 37221=20613534141227068184\ 98355\ 74122\ 37221=206135341\cdot 412270681

to be a strong pseudoprime to the first eight prime bases. When considering p1=206135341p_{1}=206135341, they sieved (which we explain in the next section) for p2=412270681p_{2}=412270681. It is reasonable to ask whether there is a larger prime that can be paired with p1p_{1} that would form a strong pseudoprime to eight bases. In our computation we check by computing a GCD to answer “no.”

 

Algorithm 1: Using GCDs to rule out kk values

 
  • Input:

    Integers tt and kk, where tt is the number of prime divisors and kk is the product of t1t-1 primes with matching signature, and the base vector ν\nu containing the mm smallest primes.

  • 1:

    Let bνb\in\nu give the smallest estimated value for h(b,k)h(b,k) as defined above.

  • 2:

    If b=a1b=a_{1}, let i=2i=2 else let i=1i=1.

  • 3:

    Compute h(b,k)h(b,k).

  • 4:

    Compute x=h(ai,k)modh(b,k)x=h(a_{i},k)\bmod h(b,k) using modular exponentiation.

  • 5:

    Set x=gcd(h(b,k),x)x=\gcd(h(b,k),x);

  • 6:

    while  x>kx>k and i<mi<m  do

    • 7:

      Set i=i+1i=i+1; if ai=ba_{i}=b set i=i+1i=i+1 again.

    • 8:

      Compute y=h(ai,k)modxy=h(a_{i},k)\bmod x.

    • 9:

      Set x=gcd(x,y)x=\gcd(x,y).

  • 10:

    end while

  • 11:

    if x<kx<k then

    • 12:

      We can rule out kk.

  • 13:

    else

    • 14:

      We factor xx and check each prime ptxp_{t}\mid x with pt>kp_{t}>k to see if kptkp_{t} is a strong pseudoprime.

  • 15:

    end if

 

Computing h(b,k)h(b,k) is the bottleneck of this algorithm. When using m=11m=11 or higher, we never found anything to factor in the last step.

2.3. Sieving

As above, let k=p1pt1k=p_{1}\cdots p_{t-1} and we try to construct n=kptn=kp_{t} by finding ptp_{t}. In order to search up to a bound BB, we need to search primes ptp_{t} in the interval [pt1,B/k][p_{t-1},B/k]. We combine two types of sieving to search this interval quickly. The first we call λ\lambda-sieving, and the second we call signature sieving. For each prime pp define

λp=lcm{ordp(a):aν}.\lambda_{p}=\operatorname{lcm}\left\{\mbox{ord}_{p}(a):a\in\nu\right\}.

By the r-rank Artin Conjecture [11], we expect with very high probability that λp=p1\lambda_{p}=p-1. Let λ=lcm{λp1,,λpt1}\lambda=\operatorname{lcm}\left\{\lambda_{p_{1}},\ldots,\lambda_{p_{t-1}}\right\}. Since akpt11(modn)a^{kp_{t}-1}\equiv 1\pmod{n} for any aνa\in\nu this means kpt1kp_{t}-1 is a multiple of λ\lambda. So, ptk1(modλ)p_{t}\equiv k^{-1}\pmod{\lambda}. This tells us that ptp_{t} lies in a specific residue class modulo λ\lambda, and we call searching for ptp_{t} using this value λ\lambda-sieving.

We can further narrow down the residue classes that ptp_{t} may lie in with respect to primes in ν\nu. The following two propositions appeared originally in [7].

Proposition 2.5.

For primes pp and qq, if v(p1)=v(q1)v(p-1)=v(q-1) and v(ordp(a))=v(ordq(a))v(\mbox{ord}_{p}(a))=v(\mbox{ord}_{q}(a)) then (ap)=(aq)\left(\frac{a}{p}\right)=\left(\frac{a}{q}\right).

Proposition 2.6.

For primes pp and qq, if v(p1)<v(q1)v(p-1)<v(q-1) and v(ordp(a))=v(ordq(a))v(\mbox{ord}_{p}(a))=v(\mbox{ord}_{q}(a)) then (aq)=1\left(\frac{a}{q}\right)=1.

One may consider higher reciprocity laws, and Jaeschke did so [7]. We found quadratic reciprocity sufficient.

The authors of [8] consider searching for ptp_{t} modulo lcm{λ,9240}\operatorname{lcm}\{\lambda,9240\}. They considered 3030 residue classes modulo 9240=8357119240=8\cdot 3\cdot 5\cdot 7\cdot 11 that arose from the propositions above. With the inclusion of each additional prime from ν\nu, we effectively rule out half of the cases to consider, thereby doubling the speed of the sieving process.

Ideally, we would like to include every prime in ν\nu for the best performance, but with normal sieving, the sieve modulus becomes quite large and requires we keep track of too many residue classes to be practical. Instead, we adapted the space-saving wheel datastructure [16, 15], which had been used successfully to sieve for pseudosquares. Sieving for primes ptp_{t} with specified quadratic character modulo a list of small primes is the same algorithmic problem. This wheel sieve uses a data structure that takes space proportional to aνa\sum_{a\in\nu}a instead of space proportional to aνa\prod_{a\in\nu}a as used in traditional sieving. It does, however, produce candidate primes ptp_{t} out of order. This is not an issue, so long as we make sure the sieve modulus does not exceed BB. In practice, we dynamically include primes from ν\nu so that 1000klcm{λ,8,3,5,7,11,13,17,19,23,29,31}<ψ131000\cdot k\cdot\operatorname{lcm}\{\lambda,8,3,5,7,11,13,17,19,23,29,31\}<\psi_{13}, and we favor the inclusion of smaller primes.

 

Algorithm 2: Sieving

 
  • Input:

    kk in factored form as k=p1p2pt1k=p_{1}p_{2}\cdots p_{t-1}, λpi\lambda_{p_{i}} for i<ti<t, search bound BB, and base vector ν\nu of length mm.

  • 1:

    Compute λk=lcm{λpi}\lambda_{k}=\operatorname{lcm}\{\lambda_{p_{i}}\}.

  • 2:

    Set w=1w=1. Compute wheel modulus ww as follows:

  • 3:

    for  i=2,,mi=2,\ldots,m  do

    • 4:

      if  kλkaiw<B/1000k\lambda_{k}a_{i}w<B/1000  then

      • 5:

        if  aia_{i} does not divide λk\lambda_{k}  then

        • 6:

          Set w=waiw=w\cdot a_{i}.

      • 7:

        end if

    • 8:

      end if

  • 9:

    end for

  • 10:

    if  λk\lambda_{k} divisible by 4  then

    • 11:

      Set λ=λk\lambda=\lambda_{k}

  • 12:

    else

    • 13:

      Set λ=λk/2\lambda=\lambda_{k}/2 and

    • 14:

      Set w=8ww=8w

  • 15:

    end if

  • 16:

    Let σ\sigma be the signature of p1p_{1}.

  • 17:

    Build a wheel with modulus ww so that for each prime power qwq\mid w we have primes pp generated by the wheel with (p/q)(p/q) consistent with σ\sigma as in Propositions 2.5 and 2.6.

  • 18:

    for  each residue rr modulo ww generated by the wheel  do

    • 19:

      Use the Chinese Remainder Theorem to compute xmodwλx\bmod w\lambda such that xrmodwx\equiv r\bmod w and xk1modλx\equiv k^{-1}\bmod\lambda.

    • 20:

      Sieve for primes in the interval [k+1,B/k][k+1,B/k] that are xmodwλ\equiv x\bmod w\lambda.

    • 21:

      For each such probable prime ptp_{t} found, perform a strong pseudoprime test on kptkp_{t}.

  • 22:

    end for

 

Note that if kk consists entirely of primes that are 3mod4\equiv 3\bmod 4, then all primes ptp_{t} found by the sieve, when using all of ν\nu, will have the correct signature.

Example 2.7.

Consider p=3108+317p=3\cdot 10^{8}+317. Now, λ=p1=227112342349\lambda=p-1=2^{2}\cdot 7\cdot 11\cdot 23\cdot 42349 (factorization is obtained via sieving). We may use signature information for the primes 33, 55, 1313, 1717, 1919, 2929, 3131, and 3737. However, since B=41024B=4\cdot 10^{24} we may only use the first 4 primes in the signature before the combined modulus is too large. The signature information for 3 implies that q5,7(mod12)q\equiv 5,7\pmod{12} however, the case q7(mod12)q\equiv 7\pmod{12} need not be considered since we know (because of λ\lambda) that q1(mod4)q\equiv 1\pmod{4}. Given the signature information for the primes 5 and 13, we search in {2,3(mod5)}\{2,3\pmod{5}\} and {2,5,6,7,8,11(mod13)}\{2,5,6,7,8,11\pmod{13}\}. At this point we sieve for primes q1(modλ)q\equiv 1\pmod{\lambda}. To this we add the following 12 new congruence conditions and sieve for each individual condition.

  1. (1)

    Let q2(mod5)q\equiv 2\pmod{5}.

    1. (a)

      Let q2(mod13)q\equiv 2\pmod{13}.

    2. (b)

      Let q5(mod13)q\equiv 5\pmod{13}.

    3. (c)

      Let q6(mod13)q\equiv 6\pmod{13}.

    4. (d)

      Let q7(mod13)q\equiv 7\pmod{13}.

    5. (e)

      Let q8(mod13)q\equiv 8\pmod{13}.

    6. (f)

      Let q11(mod13)q\equiv 11\pmod{13}.

  2. (2)

    Let q3(mod5)q\equiv 3\pmod{5}.

    1. (a)

      Let q2(mod13)q\equiv 2\pmod{13}.

    2. (b)

      Let q5(mod13)q\equiv 5\pmod{13}.

    3. (c)

      Let q6(mod13)q\equiv 6\pmod{13}.

    4. (d)

      Let q7(mod13)q\equiv 7\pmod{13}.

    5. (e)

      Let q8(mod13)q\equiv 8\pmod{13}.

    6. (f)

      Let q11(mod13)q\equiv 11\pmod{13}.

2.4. Hash Table Datastructure

In order to compute GCDs or sieve as described above, it is necessary to construct integers k=p1p2pt1k=p_{1}p_{2}\cdots p_{t-1} in an efficient way, where all the primes pip_{i} have matching signatures. We do this by storing all small primes in a hash table datastructure that supports the following operations:

  • Insert the prime pp with its signature σp\sigma_{p}. We assume any prime being inserted is larger than all primes already stored in the datastructure. (That is, insertions are monotone increasing.) We also store λp\lambda_{p} with pp and its signature for use later, thereby avoiding the need to factor p1p-1.

  • Fetch a list of all primes from the datastructure, in the form of a sorted array s[]s[\,], whose signatures match σ\sigma. The fetch operation brings the λp\lambda_{p} values along as well.

We then use this algorithm to generate all candidate kk values for a given tt and ν\nu:

 

Algorithm 3: Generating kk Values

 
  • Input:

    t>2t>2, search bound BB, cutoff X<BX<B, base vector ν\nu of length mm.

  • 1:

    Let TT denote our hash table datastructure

  • 2:

    Let am+1a_{m+1} denote the smallest prime not in ν\nu.

  • 3:

    for  each prime pB/am+1t2p\leq\sqrt{B/a_{m+1}^{t-2}} (with p1p-1 in factored form)  do

    • 4:

      Compute λp\lambda_{p} from the factorization of p1p-1;

    • 5:

      s[]:=Ts[\,]:=T.fetch(σp\sigma_{p}); List of primes with matching signature

    • 6:

      for  0i1<<it2s0\leq i_{1}<\cdots<i_{t-2}\leq s.length  do

      • 7:

        Form k=s[i1]s[it2]pk=s[i_{1}]\cdots s[i_{t-2}]\cdot p;

      • 8:

        if  kXk\leq X  then

        • 9:

          Use kk in a GCD computation to find matching ptp_{t} values;

      • 10:

        else

        • 11:

          Use kk for a sieving computation to find matching ptp_{t} values;

      • 12:

        end if

    • 13:

      end for

    • 14:

      if  p(B/am+1t3)1/3p\leq(B/a_{m+1}^{t-3})^{1/3}  then

      • 15:

        TT.insert(pp,σp\sigma_{p},λp\lambda_{p});

    • 16:

      end if

  • 17:

    end for

 

Note that the inner for-loop above is coded using t2t-2 nested for-loops in practice. This is partly why we wrote separate programs for each value of tt. To make this work as a single program that handles multiple tt values, one could use recursion on tt.

Also note that we split off the GCD and sieving computations into separate programs, so that the inner for-loop was coded to make sure we always had either kXk\leq X or X<k<B/pX<k<B/p as appropriate.

We implemented this datastructure as an array or table of 2m2^{m} linked lists, and used a hash function on the prime signature to compute which linked list to use. The hash function h:σ0..(2m1)h:\sigma\rightarrow 0..(2^{m}-1) computes its hash value from the signature as follows:

  • If σ=(0,0,0,,0)\sigma=(0,0,0,\ldots,0), the all-zero vector, then h(σ)=0h(\sigma)=0, and we are done.

  • Otherwise, compute a modified copy of the signature, σ\sigma^{\prime}. If σ\sigma contains only 0s and 1s, then σ=σ\sigma^{\prime}=\sigma. If not, find the largest integer entry in σ\sigma, and entries in σ\sigma^{\prime} are 1 if the corresponding entry in σ\sigma matches the maximum, and 0 otherwise.

    For example, if σ=(3,4,0,4,2,1,2,4)\sigma=(3,4,0,4,2,1,2,4) (our example from earlier), then σ=(0,1,0,1,0,0,0,1)\sigma^{\prime}=(0,1,0,1,0,0,0,1).

  • h(σ)h(\sigma) is the value of σ\sigma^{\prime} viewed as an integer in binary.

    So for our example, h((3,4,0,4,2,1,2,4))=010100012=64+16+1=81h((3,4,0,4,2,1,2,4))=01010001_{2}=64+16+1=81.

Computing a hash value takes O(m)O(m) time.

Each linked list is maintained in sorted order; since the insertions are monotone, we can simply append insertions to the end of the list, and so insertion time is dominated by the time to compute the hash value, O(m)O(m) time. Note that the signature and λp\lambda_{p} is stored with the prime for use by the fetch operation.

The fetch operation computes the hash value, and then scans the linked list, extracting primes (in order) with matching signature. If the signature to match is binary (which occurs roughly half the time), we expect about half of the primes in the list to match, so constructing the resulting array s[]s[\,] takes time linear in mm multiplied by the number of primes fetched. Note that λ\lambda values are brought along as well. Amortized over the full computation, fetch will average time that is linear in the size of the data returned. Also note that the average cost to compare signatures that don’t match is constant.

The total space used by the data structure is an array of length 2m2^{m}, plus one linked list node for each prime B1/3\leq B^{1/3}. Each linked list node holds the prime, its λ\lambda value, and its signature, for a total of O(2mlogB+mB1/3)O(2^{m}\log B+mB^{1/3}) bits, since each prime is O(logB)O(\log B) bits.

2.5. Algorithm Outline

Now that all the pieces are in place, we can describe the algorithm as a whole.

Given an input bound BB, we compute the GCD/sieve cutoff XX (this is discussed in §3 below).

We then compute GCDs as discussed above using candidate kk values X\leq X for t=2,3,t=2,3,\ldots. For some value of tt, we’ll discover that there are no candidate kk values with t1t-1 prime factors, at which point we are done with GCD computations.

Next we sieve as discussed above, using candidate kk values >X>X for t=2,3,t=2,3,\ldots. Again, for some tt value, we’ll discover there are no candidate kk values with t1t-1 prime factors, at which point we are done.

We wrote a total of eight programs; GCD programs for t=2,3,4t=2,3,4 and sieving programs for t=2,3,4,5,6t=2,3,4,5,6. Also, we did not bother to use the wheel and signature sieving, relying only on λ\lambda sieving, for t>3t>3.

3. Algorithm Analysis

3.1. Model of Computation

We assume a RAM model, with potentially infinite memory. Arithmetic operations on integers of O(logB)O(\log B) bits (single-precision) and basic array indexing and control operations all are unit cost. We assume fast, FFT-based algorithms for multiplication and division of large integers. For nn-bit inputs, multiplication and division cost M(n)=O(nlognloglogn)M(n)=O(n\log n\log\log n) operations [14]. From this, an FFT-based GCD algorithm takes O(M(n)logn)=O(n(logn)2loglogn)O(M(n)\log n)=O(n(\log n)^{2}\log\log n) operations; see, for example, [17].

3.2. Helpful Number Theory Results

Let our modulus q=aiνaiq=\prod_{a_{i}\in\nu}a_{i} so that ϕ(q)=aiνϕ(ai)\phi(q)=\prod_{a_{i}\in\nu}\phi(a_{i}); each base aia_{i} is an odd prime with ϕ(ai)=a11\phi(a_{i})=a_{1}-1, except for a1=8a_{1}=8 with ϕ(a1)=4\phi(a_{1})=4. We use our two propositions from §2.3, together with quadratic reciprocity to obtain a list of (ai1)/2(a_{i}-1)/2 residue classes for each odd prime aia_{i} and two residue classes modulo 88. The total number of residue classes is 2mϕ(q)2^{-m}\phi(q). A prime we are searching for with a matching signature must lie in one of these residue classes.

Let us clarify that when we state in sums and elsewhere that a prime pp has signature equivalent to σ\sigma, we mean that the quadratic character (p/ai)(p/a_{i}) is consistent with σ\sigma as stated in Propositions 2.5 and 2.6. We write σσp\sigma\equiv\sigma_{p} to denote this consistency under quadratic character, which is weaker than σ=σp\sigma=\sigma_{p}.

Lemma 3.1.

Given a signature σ\sigma of length mm, and let q=iaiq=\prod_{i}a_{i} as above. Let ϵ>0\epsilon>0. If q<x1ϵq<x^{1-\epsilon}, then number of primes pxp\leq x with σpσ\sigma_{p}\equiv\sigma is at most

O(x2mlogx).O\left(\frac{x}{2^{m}\log x}\right).
Proof.

This follows almost immediately from the Brun-Titchmarsh Theorem. See, for example, Iwaniec [6]. We simply sum over the relevant residue classes mod qq based on quadratic character using Propositions 2.5 and 2.6. ∎

We will choose mm proportional to logB/loglogB\log B/\log\log B so that q=Bcq=B^{c} for some constant 0<c<10<c<1.

Lemma 3.2.

We have

px,σpσ1p=O(2mloglogx).\sum_{p\leq x,\sigma_{p}\equiv\sigma}\frac{1}{p}=O(2^{-m}\log\log x).

This follows easily from Lemma 3.1 by partial summation. We could make this tighter by making use of Theorem 4 from [9], and observe that the constants C(q,a)C(q,a) (in their notation) cancel with one another in a nice fashion when summing over different residue classes modulo qq. See also section 6 of that paper.

Let πt,σ(x)\pi_{t,\sigma}(x) denote the number of integers x\leq x with exactly tt distinct prime divisors, each of which has signature equivalent to σ\sigma of length mm.

Lemma 3.3.
πt,σ(x)x(loglogx)t12tmlogx.\pi_{t,\sigma}(x)\ll\frac{x(\log\log x)^{t-1}}{2^{tm}\log x}.
Proof.

Proof is by induction on tt. t=1t=1 follows from Lemma 3.1.

For the general case, we sum over the largest prime divisor pp of nn,

πt,σ(x)\displaystyle\pi_{t,\sigma}(x) =\displaystyle= px,σp=σπt1,σ(x/p)\displaystyle\sum_{p\leq x,\sigma_{p}=\sigma}\pi_{t-1,\sigma}(x/p)
\displaystyle\ll px,σpσx(loglog(x/p))t2p2(t1)mlog(x/p)\displaystyle\sum_{p\leq x,\sigma_{p}\equiv\sigma}\frac{x(\log\log(x/p))^{t-2}}{p2^{(t-1)m}\log(x/p)}
\displaystyle\ll x(loglogx)t12tmlogx.\displaystyle\frac{x(\log\log x)^{t-1}}{2^{tm}\log x}.

We used Lemma 3.2 for the last step. (See also the proof of Theorem 437 in [5, §22.18].) ∎

Let λp,m\lambda_{p,m} denote the value of λp\lambda_{p} for the prime pp using a vector ν\nu with the first mm prime bases. We need the following lemma from [10, Cor. 2.4]:

Lemma 3.4.

There exists a constant τ>0\tau>0 such that

px1λp,mx1/(m+1)(logx)1+τ/(m+1).\sum_{p\leq x}\frac{1}{\lambda_{p,m}}\ll\frac{x^{1/(m+1)}}{(\log x)^{1+\tau/(m+1)}}.

Using this, we obtain the following.

Theorem 3.5.

Let 0<θ<10<\theta<1. Then

xθ<px1pλp,m1xθ1/(m+1)logx.\sum_{x^{\theta}<p\leq x}\frac{1}{p\lambda_{p,m}}\ll\frac{1}{x^{\theta-1/(m+1)}\log x}.
Proof.

We have

xθ<px1pλp,m\displaystyle\sum_{x^{\theta}<p\leq x}\frac{1}{p\lambda_{p,m}} \displaystyle\leq 1xθxθ<px1λp,m\displaystyle\frac{1}{x^{\theta}}\sum_{x^{\theta}<p\leq x}\frac{1}{\lambda_{p,m}}
\displaystyle\ll 1xθx1/(m+1)(logx)1+τ/(m+1).\displaystyle\frac{1}{x^{\theta}}\frac{x^{1/(m+1)}}{(\log x)^{1+\tau/(m+1)}}.

Note that τ>0\tau>0. ∎

3.3. A Conjecture

In order to prove our B2/3+o(1)B^{2/3+o(1)} running time bound for t>2t>2, we make use of the conjecture below. Let 𝒦=𝒦(t,σ){\mathcal{K}}={\mathcal{K}}(t,\sigma) be the set of integers with exactly tt distinct prime divisors each of which has signature matching σ\sigma. In other words, πt,σ(x)\pi_{t,\sigma}(x) counts integers in 𝒦\mathcal{K} bounded by xx.

Conjecture 3.6.

Let B,σ,t,m,νB,\sigma,t,m,\nu be as above. Then

kx,k𝒦(t,σ)1λk,mxo(1).\sum_{k\leq x,k\in{\mathcal{K}}(t,\sigma)}\frac{1}{\lambda_{k,m}}\ll x^{o(1)}.
Theorem 3.7.

Assuming Conjecture 3.6 is true, we have

xθkx,k𝒦(t,σ)1kλk,mxθ+o(1).\sum_{x^{\theta}\leq k\leq x,k\in\mathcal{K}(t,\sigma)}\frac{1}{k\lambda_{k,m}}\ll x^{-\theta+o(1)}.
Proof.

The proof is essentially the same as that of Theorem 3.5. Simply substitute Conjecture 3.6 for Lemma 3.4. ∎

3.4. Proof of Theorem 1.2

We now have the pieces we need to prove our running time bound.

As above, each pseudoprime candidate we construct will have the form n=kptn=kp_{t}, where kk is the product of t1t-1 distinct primes with matching signature. Again, ν=(2,3,5,)\nu=(2,3,5,\ldots) is our base vector of small primes of length mm.

3.4.1. t=2t=2

In this case kk is prime.

GCD Computation. For each prime k=pXk=p\leq X we perform a GCD computation as described in §2.2. The bottleneck of this computation is computing GCDs of O(p)O(p)-bit integers. This gives a running time proportional to

pXM(p)logp\displaystyle\sum_{p\leq X}M(p)\log p \displaystyle\ll π(X)X(logX)2loglogX\displaystyle\pi(X)X(\log X)^{2}\log\log X
\displaystyle\ll X2logXloglogX.\displaystyle X^{2}\log X\log\log X.

Sieving Computation. For each prime k=pk=p with X<p<B/pX<p<B/p, we sieve the interval [p+1,B/p][p+1,B/p] for primes that are 1modλp\equiv 1\bmod\lambda_{p}. We also employ signature sieving, but for the simplicity of analysis, we omit that for now. Using the methods from [15], we can sieve an arithmetic progression of length \ell in O(logB)O(\ell\log B) operations. We do not need proof of primality here, so a fast probabilistic test works fine. This gives a running time proportional to

X<pB/pBlogBpλpBlogBX<pB/X1pλp.\sum_{X<p\leq B/p}\frac{B\log B}{p\lambda_{p}}\ll B\log B\sum_{X<p\leq B/X}\frac{1}{p\lambda_{p}}.

At this point we know X2BX^{2}\leq B and, to keep the GCD and sieving computations balanced, XB1/4X\geq B^{1/4}, say. This means Theorem 3.5 applies; we set xθ=Xx^{\theta}=X and x=B/Xx=B/X to obtain

BlogBX<pB/X1pλp\displaystyle B\log B\sum_{X<p\leq B/X}\frac{1}{p\lambda_{p}} \displaystyle\ll BlogB(B/X)1/(m+1)Xlog(B/X)\displaystyle B\log B\frac{(B/X)^{1/(m+1)}}{X\log(B/X)}
\displaystyle\ll BX(B/X)1/(m+1)\displaystyle\frac{B}{X}(B/X)^{1/(m+1)}
=\displaystyle= (B/X)1+o(1)\displaystyle(B/X)^{1+o(1)}

assuming that mm\rightarrow\infty with BB.

Minimizing X2+o(1)+(B/X)1+o(1)X^{2+o(1)}+(B/X)^{1+o(1)} implies X=B1/3X=B^{1/3} and gives the desired running time of B2/3+o(1)B^{2/3+o(1)}. This completes our proof. .

3.4.2. t>2t>2

In this case kk is composite.

GCD Computation. For t>2t>2 we construct integers k=rpk=rp for computing GCDs, with rr consisting of exactly t2t-2 prime divisors less than pp, with signatures matching σp\sigma_{p}. For each prime pp, we perform a hash table lookup and fetch the list of such primes; this is Step 5 of Algorithm 3. This overhead cost is O(m)+O(πσp(p))=O(m+2mp/logp)O(m)+O(\pi_{\sigma_{p}}(p))=O(m+2^{-m}p/\log p). Summing this over all primes pXp\leq X gives O(2mX2/logX)O(2^{-m}X^{2}/\log X).

Next, for each prime pXp\leq X we construct at most πt2,σp(X/p)\pi_{t-2,\sigma_{p}}(X/p) values for rr (Step 7 of Algorithm 3), and using Lemma 3.3 and multiplying by the cost of computing the GCD, this gives us

(3.1) pXπt2,σp(X/p)M(X)logXX2(loglogX2m)t2logX\sum_{p\leq X}\pi_{t-2,\sigma_{p}}(X/p)\cdot M(X)\log X\ll X^{2}\left(\frac{\log\log X}{2^{m}}\right)^{t-2}\log X

for the total running time.

Sieving Computation. Again, the main loop enumerates all choices for the second-largest prime p=pt1p=p_{t-1}. First, we construct all possible kk-values with k>Xk>X, k<B/pk<B/p, and pkp\mid k, so k/p=r=p1pt2k/p=r=p_{1}\cdots p_{t-2} with all the pi<pi+1p_{i}<p_{i+1} and pt2<pp_{t-2}<p. We also have pt2<B1/3p_{t-2}<B^{1/3}. This implies p>X1/(t1)p>X^{1/(t-1)}.

For a given pp, fetching the list of primes below u:=min{p,B/p2}u:=\min\{p,B/p^{2}\} with matching signatures takes O(m+u/(2mlogu))O(m+u/(2^{m}\log u)) time (Algorithm 3 Step 5). Summing over all pBp\leq\sqrt{B}, splitting the sum at p=B1/3p=B^{1/3}, this takes 2mB2/3+o(1)2^{-m}B^{2/3+o(1)} time.

As above, we write r=k/pr=k/p. We claim that the total number of kk values is 2m(t2)B2/3+o(1)2^{-m(t-2)}B^{2/3+o(1)}. Let uu be as above. There are at most πt2,σp(u)\pi_{t-2,\sigma_{p}}(u) values of rr for each pp. Again, splitting this at B1/3B^{1/3}, we have

X1/(t1)<pB1/3πt2,σp(p)\displaystyle\sum_{X^{1/(t-1)}<p\leq B^{1/3}}\pi_{t-2,\sigma_{p}}(p) \displaystyle\ll X1/(t1)<pB1/3p(loglogp)t32(t2)mlogp\displaystyle\sum_{X^{1/(t-1)}<p\leq B^{1/3}}\frac{p(\log\log p)^{t-3}}{2^{(t-2)m}\log p}
\displaystyle\ll 2m(t2)B2/3+o(1).\displaystyle 2^{-m(t-2)}B^{2/3+o(1)}.

and

B1/3<pBπt2,σp(B/p2)\displaystyle\sum_{B^{1/3}<p\leq\sqrt{B}}\pi_{t-2,\sigma_{p}}(B/p^{2}) \displaystyle\ll B1/3<pBB(loglogB)t3p22(t2)mlogB\displaystyle\sum_{B^{1/3}<p\leq\sqrt{B}}\frac{B(\log\log B)^{t-3}}{p^{2}2^{(t-2)m}\log B}
\displaystyle\ll 1B1/3logBB(loglogB)t32(t2)mlogB\displaystyle\frac{1}{B^{1/3}\log B}\frac{B(\log\log B)^{t-3}}{2^{(t-2)m}\log B}
\displaystyle\ll 2m(t2)B2/3+o(1).\displaystyle 2^{-m(t-2)}B^{2/3+o(1)}.

This covers work done at Step 7 of Algorithm 3.

Finally, the cost of sieving is at most

X1/(t1)<pBrBlogBrpλrp.\displaystyle\sum_{X^{1/(t-1)}<p\leq\sqrt{B}}\sum_{r}\frac{B\log B}{rp\lambda_{rp}}.

If we use Theorem 3.7, based on our conjecture, and using the lower bound Xk=rpX\leq k=rp, this leads to the bound

(3.2) (loglogB2m)t2B1+1/(m+1)+o(1)X.\left(\frac{\log\log B}{2^{m}}\right)^{t-2}\frac{B^{1+1/(m+1)+o(1)}}{X}.

Without the conjecture, we use Lemma 3.2 together with the argument outlined in Hardy and Wright [5] in deriving (22.18.8), we obtain that

r1r(loglogB2m)t2.\sum_{r}\frac{1}{r}\sim\left(\frac{\log\log B}{2^{m}}\right)^{t-2}.

We then use

1λrp1λp.\frac{1}{\lambda_{rp}}\leq\frac{1}{\lambda_{p}}.

As above, this leads to the bound

(3.3) (loglogB2m)t2B1+1/(m+1)X1/(t1).\left(\frac{\log\log B}{2^{m}}\right)^{t-2}\frac{B^{1+1/(m+1)}}{X^{1/(t-1)}}.

To balance the cost of GCDs with sieving, we want to balance (3.1) with (3.2) or (3.3), depending on whether we wish to assume our conjecture or not. Simplifying a bit, this means balancing X2+o(1)X^{2+o(1)} with either (B/X)1+o(1)(B/X)^{1+o(1)} or B1+o(1)/X1/(t1)B^{1+o(1)}/X^{1/(t-1)}. The optimal cutoff point is then either X=B1/3X=B^{1/3} under the assumption of Conjecture 3.6, or X=B(t1)/(2t1)X=B^{({t-1})/({2t-1})} unconditionally, for a total time of

(loglogB2m)t2B2/3+o(1)\left(\frac{\log\log B}{2^{m}}\right)^{t-2}B^{2/3+o(1)}

with our conjecture, or

(loglogB2m)t2B112t1+o(1)\left(\frac{\log\log B}{2^{m}}\right)^{t-2}B^{1-\frac{1}{2t-1}+o(1)}

without. We have proven the following.

Theorem 3.8.

Assuming Conjecture 3.6, our algorithm takes B2/3+o(1)B^{2/3+o(1)} time to find all integers nBn\leq B that are strong pseudoprimes to the first mm prime bases, if mm\rightarrow\infty with BB.

If we choose mm so that qq is a fractional power of BB, then Lemma 3.3 implies that there is a constant c>0c>0 such that if t>cloglogBt>c\log\log B, then there is no work to do. This explains why our computation did not need to go past t=6t=6. It also explains why, in practice, the t=2t=2 case is the bottleneck of the computation, and is consistent with the implications of our conjecture that the work for each value of tt decreases as tt increases.

4. Implementation Details

In this final section, we conclude with some details from our algorithm implementation.

4.1. Strong Pseudoprimes Found

In addition to our main results for ψ12\psi_{12} and ψ13\psi_{13}, we discovered the following strong pseudoprimes. This first table contains pseudoprimes found while searching for ψ12\psi_{12}

nn Factorization
3825123056546413051 747451\cdot 149491 \cdot34233211
230245660726188031 787711\cdot 214831\cdot 1360591
360681321802296925566181 424665351661\cdot849330703321
164280218643672633986221 286600958341\cdot573201916681
318665857834031151167461 399165290221\cdot798330580441
7395010240794120709381 60807114061\cdot121614228121
164280218643672633986221 286600958341\cdot573201916681

This second table contains pseudoprimes found while verifying ψ13\psi_{13}.

nn Factorization
318665857834031151167461 399165290221\cdot798330580441
2995741773170734841812261 1223875355821\cdot2447750711641
667636712015520329618581 577770158461\cdot1155540316921
3317044064679887385961981 1287836182261\cdot2575672364521
3317044064679887385961981 1247050339261\cdot2494100678521
552727880697763694556181 525703281661\cdot1051406563321
360681321802296925566181 424665351661\cdot849330703321
7395010240794120709381 60807114061\cdot121614228121
3404730287403079539471001 1304747157001\cdot2609494314001
164280218643672633986221 286600958341\cdot573201916681

4.2. Hash Table Datastructure

It is natural to wonder how much time is needed to manage the hash table datastructure from §2.4. Specifically, we measured the time to create the table when inserting all primes up to a set bound. For this measurement, we used a vector ν\nu with the first 8 prime bases. We also measured how long it took, for each prime up to the bound listed, to also perform the fetch operation, which returns a list of primes with matching signature with λ\lambda values.

Largest Prime Table Entries Creation Time Fetching Time
10610^{6} 78490 1.13 2.58
10710^{7} 664571 11.49 2:44.49
10810^{8} 5761447 1:56.22 3:30:50.2

The times are given in seconds, or minutes:seconds, or hours:minutes:seconds as appropriate.

We felt the data structure was a success, in that it was fast and small enough that it was not noticed in the larger computation.

4.3. Almost-Linear GCDs

Refer to caption
Figure 1. GCD timings

In Figure 1, we present the times to perform Algorithm 1 on selected prime values for kk (so this is for the t=2t=2 case). The data points were obtained by averaging the time needed to carry out Algorithm 1 for the first ten primes exceeding n107n\cdot 10^{7} for 1n351\leq n\leq 35. Averaging was required because the size of the hh values is not uniformly increasing in kk. This explains the variance in the data; for example, the first ten primes after 3510735\cdot 10^{7} happened to have smaller hh values on average than the first ten primes after 3410734\cdot 10^{7}.

It should be clear from the data that our GMP algorithm for computing GCDs was using an essentially linear-time algorithm. Note that if we chose to extend the computation to large enough kk values, memory would become a concern and we would expect to see paging/thrashing degrade performance.

4.4. GCD/Sieving Crossover

Refer to caption
Figure 2. Signature Sieving and GCD timing

In Figure 2, we present a comparison of the timings for computing GCDs (Algorithm 1, diamonds on the graph) with signature sieving (Algorithm 2, squares on the graph). For this graph, we are looking at choosing the crossover point XX, and again, we are focusing on the t=2t=2 case.

  • One would expect that the signature sieving curve should behave as an inverse quadratic; the time to sieve for one prime k=pk=p is proportional to

    BlogBpλp\frac{B\log B}{p\lambda_{p}}

    and we expect λpp1\lambda_{p}\approx p-1 most of the time. However, utilizing signatures obscures this to some degree, since the algorithm cannot make use of all prime bases if they divide λ\lambda, hence the minor variations in the curve. Let us elaborate this here.

    The data points for signature sieving in Figure 2 represent the average sieve time for the first 50 primes past n107n\cdot 10^{7} for 10n6010\leq n\leq 60. There is a lot of variance in these timing because of the inclusion and exclusion of primes from the signature depending if they are relatively prime to λ\lambda. For example, p=174594421p=174594421 has λ=2233511131719\lambda=2^{2}\cdot 3^{3}\cdot 5\cdot 11\cdot 13\cdot 17\cdot 19 and therefore has few primes from the base set to use in signature sieving. The inability to add extra primes shows up in the timing data; a careful inspection of the data shows a strange jump when primes transition from 2810728\cdot 10^{7} to 2910729\cdot 10^{7}. The data points to a steady decrease, then an almost two fold increase in time followed by a steady decrease again. We believe this is because, on average, one less base prime may be used in signature sieving. Using one less base prime results in approximately twice as much work.

  • In the computation for ψ12\psi_{12}, our actual crossover point XX was 3010730\cdot 10^{7}, even though the timing data would suggest the optimal crossover point is around 1210712\cdot 10^{7}. From a cost-efficiency point of view, we chose poorly. However, the choice was made with two considerations. One is that the program to compute GCDs (Algorithm 1) is simple to write, so that program was up and running quickly, and we let it run while we wrote the sieving code (Algorithm 2). Second is that, initially, we did not know which ψm\psi_{m} value we would ultimately be able to compute. Since the results from GCD computations apply to all larger values of mm, we opted to err in favor of computing more GCDs.

4.5. Signature Sieving

Refer to caption
Figure 3. Signature Sieving and λ\lambda-Sieving

Figure 3 shows the impact that signature sieving makes. Here the squares in the graph give λ\lambda-sieving times with no signature information used, and the diamonds show the same λ\lambda-sieving work done while taking advantage of signature information using the space-saving wheel. Since there is relatively little variance involved in λ\lambda-sieving, each point represents the first prime after n107n\cdot 10^{7} for 10n6010\leq n\leq 60. On the same interval signature sieving practically looks like it takes constant time compared to λ\lambda-sieving. If we had opted to not incorporate signature sieving in, then the expected crossover point given these timings would occur when the primes are around 4210742\cdot 10^{7}.

References

  • [1] Eric Bach, Explicit bounds for primality testing and related problems, Math. Comp. 55 (1990), no. 191, 355–380. MR 1023756 (91m:11096)
  • [2] Daniel Bleichenbacher, Efficiency and security of cryptosystems based on number theory, Ph.D. thesis, Swiss Federal Institute of Technology Zurich, 1996.
  • [3] François G. Dorais and Dominic Klyve, A Wieferich prime search up to 6.7×10156.7\times 10^{15}, J. Integer Seq. 14 (2011), no. 9, Article 11.9.2, 14. MR 2859986
  • [4] Brian Dunten, Julie Jones, and Jonathan Sorenson, A space-efficient fast prime number sieve, Inform. Process. Lett. 59 (1996), no. 2, 79–84. MR 1409956 (97g:11141)
  • [5] G. H. Hardy and E. M. Wright, An introduction to the theory of numbers, 5th ed., Oxford University Press, 1979.
  • [6] Henryk. Iwaniec, On the Brun-Titchmarsh theorem, J. Math. Soc. Japan 34 (1982), no. 1, 95–123.
  • [7] Gerhard Jaeschke, On strong pseudoprimes to several bases, Math. Comp. 61 (1993), no. 204, 915–926. MR 1192971 (94d:11004)
  • [8] Yupeng Jiang and Yingpu Deng, Strong pseudoprimes to the first eight prime bases, Math. Comp. (2014), 1–10 (electronic).
  • [9] A. Languasco and A. Zaccagnini, A note on Mertens’ formula for arithmetic progressions, Journal of Number Theory 127 (2007), no. 1, 37 – 46.
  • [10] Francesco Pappalardi, On the order of finitely generated subgroups of q*(mod p) and divisors of p−1, Journal of Number Theory 57 (1996), no. 2, 207 – 222.
  • [11] Francesco Pappalardi, On the rr-rank Artin conjecture, Math. Comp. 66 (1997), no. 218, 853–868. MR 1377664 (97f:11082)
  • [12] Carl Pomerance, J. L. Selfridge, and Samuel S. Wagstaff, Jr., The pseudoprimes to 2510925\cdot 10^{9}, Math. Comp. 35 (1980), no. 151, 1003–1026. MR 572872 (82g:10030)
  • [13] Michael O. Rabin, Probabilistic algorithm for testing primality, J. Number Theory 12 (1980), no. 1, 128–138. MR 566880 (81f:10003)
  • [14] A. Schönhage and V. Strassen, Schnelle Multiplikation großer Zahlen, Computing (Arch. Elektron. Rechnen) 7 (1971), 281–292, MR 45 #1431. MR 45 #1431
  • [15] Jonathan P. Sorenson, The pseudosquares prime sieve, Algorithmic number theory, Lecture Notes in Comput. Sci., vol. 4076, Springer, Berlin, 2006, pp. 193–207. MR 2282925 (2007m:11168)
  • [16] Jonathan P. Sorenson, Sieving for pseudosquares and pseudocubes in parallel using doubly-focused enumeration and wheel datastructures, Proceedings of the 9th International Symposium on Algorithmic Number Theory (ANTS-IX) (Nancy, France) (Guillaume Hanrot, Francois Morain, and Emmanuel Thomé, eds.), Springer, July 2010, LNCS 6197, ISBN 978-3-642-14517-9, pp. 331–339.
  • [17] Damien Stehlé and Paul Zimmermann, A binary recursive GCD algorithm, Sixth International Algorithmic Number Theory Symposium (Burlington, Vermont, USA) (Duncan Buell, ed.), Springer, June 2004, LNCS 3076, pp. 411–425. MR MR2138011 (2006e:11194)
  • [18] Zhenxiang Zhang, Two kinds of strong pseudoprimes up to 103610^{36}, Math. Comp. 76 (2007), no. 260, 2095–2107 (electronic). MR 2336285 (2008h:11114)