Generated by GPT-5-mini| Baillie–PSW primality test | |
|---|---|
| Name | Baillie–PSW primality test |
| Type | Probabilistic primality test |
| Authors | William Baillie; Samuel S. Wagstaff Jr.; Hans R. P. B. Pomerance |
| First published | 1980s |
| Classification | Probabilistic algorithm |
| Typical input | Integer n > 1 |
| Output | "probably prime" or "composite" |
Baillie–PSW primality test
The Baillie–PSW primality test is a combined probabilistic algorithm used to assess whether a given positive integer is prime, developed in the late 20th century and widely employed in computational number theory and software libraries. The test blends a strong probable prime test based on Fermat's little theorem with a strong Lucas probable prime check, producing results that have resisted counterexamples despite extensive empirical scrutiny by researchers and institutions. It is notable for practical reliability in applications ranging from cryptography to computational projects associated with organizations and mathematicians.
The test originated from investigations by William Baillie and later formalized with contributions by Samuel S. Wagstaff Jr. and influences from work by Carl Pomerance and collaborators associated with computational projects at institutions like Bell Labs, RAND Corporation, and various university laboratories. It is commonly used in software produced by projects such as GNU Project utilities, OpenSSL, and libraries maintained by contributors affiliated with Debian, NetBSD, and other open-source organizations. Practitioners in cryptography from groups linked to RSA Security and academic researchers at places like Princeton University, Massachusetts Institute of Technology, and University of Cambridge have adopted or evaluated the test. The test's practical appeal brought it into toolchains used by teams working on distributed efforts like Great Internet Mersenne Prime Search and numeric computations in environments developed by companies such as Intel and AMD.
The algorithm applies two sequential checks: first a base-2 strong probable prime (SPRP) test derived from methods related to work by Édouard Lucas and concepts popularized by Fermat, and second a strong Lucas probable prime (SLPRP) test using parameters determined by a quadratic character selection akin to procedures in classical studies by Adrien-Marie Legendre and Carl Friedrich Gauss. The SPRP stage uses exponentiation modulo n with bases motivated by analyses by Robert Baillie and contemporaries, while the Lucas stage computes terms in Lucas sequences with discriminant selection informed by criteria invoked in research at institutions such as Harvard University and University of California, Berkeley. Pseudocode implementations follow established modular exponentiation routines that parallel algorithms described by practitioners at Bell Labs and in textbooks associated with authors like Donald Knuth and Richard Brent.
The theoretical justification leverages algebraic number theory linked to concepts developed by Gustav Lejeune Dirichlet and Helmut Hasse, including properties of quadratic residues and orders in multiplicative groups modulo n; these underpin both the SPRP and Lucas components. Heuristic confidence arises from statistical arguments similar to those used in analyses by Pomerance, Jaap van de Lune, and Carl Pomerance's collaborators, combining distributional expectations studied by researchers at Institute for Advanced Study and probabilistic models referenced in work at Bell Labs and AT&T. Connections to primality criteria explored by Srinivasa Ramanujan and later formalized in computational settings by academics at University of Oxford and University of Cambridge inform why combined tests drastically reduce false-positive rates. The Lucas test's discriminant choice echoes classical reciprocity laws originating with Leonhard Euler and Adrien-Marie Legendre.
No composite integer is known to pass both stages, despite exhaustive searches up to very large bounds undertaken by teams at projects affiliated with Great Internet Mersenne Prime Search, researchers at University of Bonn, and contributors to repositories maintained by GitHub and SourceForge. Empirical validation has been reported in computational studies by groups at University of Waterloo, Max Planck Institute for Mathematics, and practitioners who collaborate with entities like Google and Microsoft Research. Formal proofs of absolute correctness remain elusive, and theoretical work by scholars associated with Princeton University and Rutgers University continues to investigate potential counterexamples; nonetheless, the test's practical reliability rivals deterministic tests used in constrained settings by engineers at NIST and cryptographers associated with IETF.
Implementations appear in widely used libraries and programs produced by maintainers at GNU Project, OpenBSD, LibreSSL, and language runtimes such as those maintained by teams at Oracle Corporation and Mozilla Foundation. Performance comparisons reported in benchmarking studies by researchers at University of Illinois Urbana–Champaign and industry evaluations by Intel and AMD indicate favorable trade-offs between speed and accuracy, especially for inputs within bit-length ranges common in protocols standardized by IETF and NIST. Highly optimized implementations exploit assembly and platform-specific arithmetic techniques developed by contributors affiliated with Cryptography Research, Inc. and academic groups at University of Tokyo and University of Waterloo.
Variants combine alternate bases in the SPRP stage or modify Lucas parameter selection following theoretical suggestions from papers by researchers at École Normale Supérieure, Harvard University, and Massachusetts Institute of Technology. Improvements in speed and reliability mirror algorithmic refinements influenced by work at Bell Labs and modern analyses by teams at Microsoft Research and Google Research, while hybrid approaches integrate deterministic methods like the AKS primality test or elliptic-curve primality proving techniques associated with researchers at Brown University and University of Illinois. Ongoing contributions from scholars at Princeton University and open-source communities continue to refine implementations and empirical testing strategies.
Category:Primality tests