TOPICS
Search

Baillie-PSW Primality Test


The Baillie-PSW primality test combines tests for strong pseudoprimes and Lucas pseudoprimes (Baillie and Wagstaff 1980, Pomerance et al. 1980, Pomerance 1984). There are a number of variants, one particular version of which is given by the following algorithm (Pomerance 1984):

1. Perform a base-2 strong pseudoprime test on n. If this test fails, declare n composite and halt. If this test succeeds, n is probably prime. Proceed to step 2.

2. In the sequence 5, -7, 9, -11, 13, ..., find the first number D for which the Jacobi symbol (D/n)=-1. Then perform a Lucas pseudoprime test with discriminant D on n. If this test fails, declare n composite. If it succeeds, n is very probably prime.

Zhang (2002, Definition 2.2 and Theorem 4) proposed a related one-parameter quadratic-base test. It uses two independently chosen quadratic bases with opposite Jacobi symbol values for their discriminants. Zhang derived bounds on the probability that an odd composite number passes this randomized test.

Pomerance (1984) originally offered a prize of $30 for discovery of a composite number which passes this test, but the dollar amount of the offer was subsequently raised to $620 (Guy 1994, p. 28).

As of Oct. 2026, no examples of composite numbers passing the test are known. Baillie et al. (2021) checked Feitsma's complete list of base-2 Fermat pseudoprimes below 2^(64). None passed the Lucas pseudoprime test with their parameter selection method A*. This also rules out counterexamples in that range for the variant that keeps method A* and uses the stronger base-2 test.


See also

Lucas Pseudoprime, Strong Pseudoprime

Explore with Wolfram|Alpha

References

Arnault, F. "Sur quelques tests probabilistes de primalité." PhD thesis. Poitiers, France: Université de Poitiers, p. 72, 1993. https://theses.fr/1993POIT2317.Baillie, R.; Fiori, A.; and Wagstaff, S. S. Jr. "Strengthening the Baillie-PSW Primality Test." Math. Comput. 90, 1931-1955, 2021. https://doi.org/10.1090/mcom/3616.Baillie, R. and Wagstaff, S. S. Jr. "Lucas Pseudoprimes." Math. Comput. 35, 1391-1417, 1980. https://doi.org/10.1090/s0025-5718-1980-0583518-6.Gilchrist, J. "Pseudoprime Enumeration with Probabilistic Primality Tests (Fermat Base 2, Baillie-PSW)." https://gilchrist.great-site.net/jeff/factoring/pseudoprimes.html.Guy, R. K. "Pseudoprimes. Euler Pseudoprimes. Strong Pseudoprimes." §A12 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 27-30, 1994.Nicely, T. R. "The Baillie-PSW Primality Test." https://faculty.lynchburg.edu/~nicely/misc/bpsw.html.Pomerance, C. "Are There Counterexamples to the Baillie-PSW Primality Test?" 1984. https://pseudoprime.com/dopo.pdf.Pomerance, C.; Selfridge, J. L.; and Wagstaff, S. S. Jr. "The Pseudoprimes to 25·10^9." Math. Comput. 35, 1003-1026, 1980. https://doi.org/10.1090/s0025-5718-1980-0572872-7.Zhang, Z. "A One-Parameter Quadratic-Base Version of the Baillie-PSW Probable Prime Test." Math. Comput. 71, 1699-1734, 2002. https://doi.org/10.1090/S0025-5718-02-01424-2.

Referenced on Wolfram|Alpha

Baillie-PSW Primality Test

Cite this as:

Weisstein, Eric W. "Baillie-PSW Primality Test." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Baillie-PSWPrimalityTest.html

Subject classifications