Baillie–PSW primality test

Unsolved problem in mathematics:
Is there a composite number that passes the Baillie–PSW primality test?

The Baillie–PSW primality test is a probabilistic or possibly deterministic primality testing algorithm that determines whether a number is composite or is a probable prime. It is named after Robert Baillie, Carl Pomerance, John Selfridge, and Samuel Wagstaff.

The Baillie–PSW test is a combination of a strong Fermat probable prime test to base 2 and a standard or strong Lucas probable prime test. The Fermat and Lucas test each have their own list of pseudoprimes, that is, composite numbers that pass the test. For example, the first ten strong pseudoprimes to base 2 are

2047, 3277, 4033, 4681, 8321, 15841, 29341, 42799, 49141, and 52633 (sequence A001262 in the OEIS).

The first ten strong Lucas pseudoprimes (with Lucas parameters (P, Q) defined by Selfridge's Method A) are

5459, 5777, 10877, 16109, 18971, 22499, 24569, 25199, 40309, and 58519 (sequence A217255 in the OEIS).

There is no known overlap between these lists, and there is even evidence that the numbers tend to be of different kind, in fact even with standard and not strong Lucas test there is no known overlap. For example, Fermat pseudoprimes to base 2 tend to fall into the residue class 1 (mod m) for many small m, whereas Lucas pseudoprimes tend to fall into the residue class −1 (mod m).[1]: §6 [2]: Table 2 & §5  As a result, a number that passes both a strong Fermat base 2 and a strong Lucas test is very likely to be prime. If you choose a random base, there might be some composite n that passes both the Fermat and Lucas tests. For example, n=5777 is a strong psp base 76, and is also a strong Lucas pseudoprime.

No composite number below 264 (approximately 1.845·1019) passes the strong or standard Baillie–PSW test,[3] that result was also separately verified by Charles Greathouse in June 2011. Consequently, this test is a deterministic primality test on numbers below that bound. There are also no known composite numbers above that bound that pass the test, in other words, there are no known Baillie–PSW pseudoprimes.

In 1980, the authors Pomerance, Selfridge, and Wagstaff offered $30 for the discovery of a counterexample, that is, a composite number that passed this test. Richard Guy incorrectly stated that the value of this prize had been raised to $620, but he was confusing the Lucas sequence with the Fibonacci sequence, and his remarks really apply only to a conjecture of Selfridge's.[4] As of June 2014 the prize remains unclaimed. However, a heuristic argument by Pomerance suggests that there are infinitely many counterexamples.[5] Moreover, Chen and Greene[6][7] have constructed a set S of 1248 primes such that, among the nearly 21248 products of distinct primes in S, there may be about 740 counterexamples. However, they are talking about the weaker PSW test that substitutes a Fibonacci test for the Lucas test.

The test

Let n be the odd positive integer that we wish to test for primality.

  1. Optionally, perform trial division to check if n is divisible by a small prime number less than some convenient limit.
  2. Perform a base 2 strong probable prime test. If n is not a strong probable prime base 2, then n is composite; quit.
  3. Find the first D in the sequence 5, −7, 9, −11, 13, −15, ... for which the Jacobi symbol (D/n) is −1. Set P = 1 and Q = (1 − D) / 4.
  4. Perform a strong Lucas probable prime test on n using parameters D, P, and Q. If n is not a strong Lucas probable prime, then n is composite. Otherwise, n is almost certainly prime.

Remarks.

  1. The first step is for efficiency only. The Baillie–PSW test works without this step, but if n has small prime factors, then the quickest way to show that n is composite is to find a factor by trial division.
  2. Step 2 is, in effect, a single application of the Miller–Rabin primality test, but using the fixed base 2. There is nothing special about using base 2; pseudoprimes to different bases seem to have the same growth rate[1],: §8  so other bases might work just as well. However, much work has been done (see above) to verify that the combination of the base 2 strong probable prime test and a strong Lucas test does a good job of distinguishing primes from composites.
  3. Baillie and Wagstaff proved in Theorem 9 on page 1413 of[2] that the average number of Ds that must be tried is about 3.147755149.
  4. If n is a perfect square, then step 3 will never yield a D with (D/n) = −1; this is not a problem because perfect squares are easy to detect using Newton's method for square roots. If step 3 fails to produce a D quickly, one should check whether n is a perfect square.
  5. Given n, there are other methods for choosing D, P, and Q.[2]: 1401, 1409  What is important is that the Jacobi symbol (D/n) be −1. Bressoud and Wagon explain why we want the Jacobi symbol to be −1, as well as why one gets more powerful primality tests if Q ≠ ±1.[8]: 266–269 
  6. Section 6 of[2] recommends that if Q ≠ ±1, a good primality test should also check two additional congruence conditions. These two congruences involve almost no extra computational cost, and are only rarely true if n is composite: and .
  7. There are weaker versions of the Baillie–PSW test, and this one is sometimes referred to as the Strong Baillie–PSW test.
  8. If the Lucas test is replaced by a Fibonacci test, then it shouldn't be called a Baillie–PSW test, but rather a Selfridge test or a PSW test. See Selfridge's conjecture about primality testing.
  9. Pomerance, Selfridge and Wagstaff offered $30 in 1980 for a composite number passing a weaker version of the Baillie–PSW test. Such a number passing the (strong) Baillie–PSW test would qualify.[1]
  10. With an appropriate method of choosing D, P, and Q, there are only five odd, composite numbers (also called Dickson pseudoprimes of the second kind) less than 1015 for which .[9] The authors of[9] suggest a stronger version of the Baillie–PSW primality test that includes this congruence; the authors offer a $2000 reward for a composite number that passes this stronger test. This version of the algorithm is already used in Mathematica.

The danger of relying only on Fermat tests

There is significant overlap among the lists of pseudoprimes to different bases.

Choose a base a. If n is a pseudoprime to base a, then n is likely to be one of those few numbers that is a pseudoprime to many bases.[10]

For example, n = 341 is a pseudoprime to base 2. It follows from Theorem 1 on page 1392 of[2] that there are 100 values of a (mod 341) for which 341 is a pseudoprime base a. (The first ten such a are 1, 2, 4, 8, 15, 16, 23, 27, 29, and 30). The proportion of such a compared to n is usually much smaller.

Therefore, if n is a pseudoprime to base a, then n is more likely than average to be a pseudoprime to some other base.[1]: 1020  For example, there are 21853 pseudoprimes to base 2 up to 25·109. This is only about two out of every million odd integers in this range. However:[1]: 1021 

  • 4709 of these 21853 numbers (over 21 percent) are also pseudoprimes to base 3;
  • 2522 of these 4709 numbers (over 53 percent) are pseudoprimes to bases 2, 3, and 5;
  • 1770 of these 2522 numbers (over 70 percent) are pseudoprimes to bases 2, 3, 5, and 7.

The number 29341 is the smallest pseudoprime to bases 2 through 12. All of this suggests that probable prime tests to different bases are not independent of each other, so that performing Fermat probable prime tests to more and more bases will give diminishing returns. On the other hand, the calculations in [2]: 1400  and the calculations up to 264 mentioned above suggest that Fermat and Lucas probable prime tests are independent, so that a combination of these types of tests would make a powerful primality test, especially if the strong forms of the tests are used.

Note that a number that is pseudoprime to all prime bases 2, ..., p is also pseudoprime to all bases that are p-smooth.

There is also overlap among strong pseudoprimes to different bases. For example, 1373653 is the smallest strong pseudoprime to bases 2 through 4, and 3215031751 is the smallest strong pseudoprime to bases 2 through 10. Arnault [11] gives a 397-digit Carmichael number N that is a strong pseudoprime to all prime bases less than 307. Because this N is a Carmichael number, N is also a (not necessarily strong) pseudoprime to all bases less than p, where p is the 131-digit smallest prime factor of N. A quick calculation shows that N is not a Lucas probable prime when D, P, and Q are chosen by the method described above, so this number would be correctly determined by the Baillie–PSW test to be composite.

Applications of combined Fermat and Lucas primality tests

The following computer algebra systems and software packages use some version of the Baillie–PSW primality test.

Maple's isprime function,[12] Mathematica's PrimeQ function (that already uses 2020's version of Baillie–PSW),[13] PARI/GP's isprime and ispseudoprime functions,[14] and SageMath's is_pseudoprime function[15] all use a combination of a Fermat strong probable prime test and a Lucas test. Maxima's primep function uses such a test for numbers greater than 341550071728321.[16]

The FLINT library has functions n_is_probabprime and n_is_probabprime_BPSW that use a combined test, as well as other functions that perform Fermat and Lucas tests separately.[17]

The BigInteger class in standard versions of Java and in open-source implementations like OpenJDK has a method called isProbablePrime. This method does one or more Miller–Rabin tests with random bases. If n, the number being tested, has 100 bits or more, this method also does a non-strong Lucas test that checks whether Un+1 is 0 (mod n).[18][19] The use of random bases in the Miller–Rabin tests has an advantage and a drawback compared to doing a single base 2 test as specified in the Baillie–PSW test. The advantage is that, with random bases, one can get a bound on the probability that n is composite. The drawback is that, unlike the Baillie–PSW test, one cannot say with certainty that if n is less than some fixed bound such as 264, then n is prime.

In Perl, the Math::Primality[20] and Math::Prime::Util[21][22] modules have functions to perform the strong Baillie–PSW test as well as separate functions for strong pseudoprime and strong Lucas tests. In Python, the NZMATH[23] library has the strong pseudoprime and Lucas tests, but does not have a combined function. The SymPy[24] library does implement this.

As of 6.2.0, GNU Multiple Precision Arithmetic Library's mpz_probab_prime_p function uses a strong Lucas test and a Miller–Rabin test; previous versions did not make use of Baillie–PSW.[25] Magma's IsProbablePrime and IsProbablyPrime functions use 20 Miller–Rabin tests for numbers > 34·1013, but do not combine them with a Lucas probable prime test.[26]

Cryptographic libraries often have prime-testing functions. Albrecht et al. discuss the tests used in these libraries. Some use a combined Fermat and Lucas test; many do not.[27]: Table 1  For some of the latter, Albrecht, et al. were able to construct composite numbers that the libraries declared to be prime.

References

  1. ^ a b c d e Pomerance, Carl; Selfridge, John L.; Wagstaff, Samuel S. Jr. (July 1980). "The pseudoprimes to 25·109" (PDF). Mathematics of Computation. 35 (151): 1003–1026. doi:10.1090/S0025-5718-1980-0572872-7. JSTOR 2006210.
  2. ^ a b c d e f Baillie, Robert; Wagstaff, Samuel S. Jr. (October 1980). "Lucas Pseudoprimes" (PDF). Mathematics of Computation. 35 (152): 1391–1417. doi:10.1090/S0025-5718-1980-0583518-6. JSTOR 2006406. MR 0583518.
  3. ^ Nicely, Thomas R. (2012-01-13) [First published 2005-06-10]. "The Baillie–PSW Primality Test". trnicely.net. Archived from the original on 2019-11-21. Retrieved 2013-03-17.
  4. ^ Guy, R. (1994). "Pseudoprimes. Euler Pseudoprimes. Strong Pseudoprimes." §A12 in Unsolved Problems in Number Theory. 2nd ed., p. 28, New York: Springer-Verlag. ISBN 0-387-20860-7.
  5. ^ Pomerance, C. (1984). "Are There Counterexamples to the Baillie–PSW Primality Test?" (PDF).
  6. ^ Greene, John R. (n.d.). "Baillie–PSW". University of Minnesota Duluth. Retrieved May 29, 2020.
  7. ^ Chen, Zhuo; Greene, John (August 2003). "Some Comments on Baillie–PSW Pseudoprimes" (PDF). The Fibonacci Quarterly. 41 (4): 334–344.
  8. ^ Bressoud, David; Wagon, Stan (2000). A Course in Computational Number Theory. New York: Key College Publishing in cooperation with Springer. ISBN 978-1-930190-10-8.
  9. ^ a b Robert Baillie; Andrew Fiori; Samuel S. Wagstaff, Jr. (July 2021). "Strengthening the Baillie-PSW Primality Test". Mathematics of Computation. 90 (330): 1931–1955. arXiv:2006.14425. doi:10.1090/mcom/3616. ISSN 0025-5718. S2CID 220055722.
  10. ^ Wagstaff, Samuel S. Jr. (1982). "Pseudoprimes and a generalization of Artin's conjecture". Acta Arithmetica. 41 (2): 141–150. doi:10.4064/aa-41-2-141-150.
  11. ^ Arnault, F. (August 1995). "Constructing Carmichael Numbers Which Are Strong Pseudoprimes to Several Bases". Journal of Symbolic Computation. 20 (2): 151–161. doi:10.1006/jsco.1995.1042.
  12. ^ isprime - Maple Help documentation at maplesoft.com.
  13. ^ Wolfram Language & System Documentation Center - Some Notes on Internal Implementation documentation at wolfram.com.
  14. ^ User's Guide to PARI/GP (version 2.11.1) documentation for PARI/GP.
  15. ^ SageMath Documentation documentation for SageMath.
  16. ^ Maxima Manual documentation for Maxima.
  17. ^ FLINT: Fast Library for Number Theory documentation for FLINT 2.5.
  18. ^ BigInteger.java DocJar: Search Open Source Java API.
  19. ^ BigInteger.java documentation for OpenJDK.
  20. ^ Math::Primality Perl module with BPSW test
  21. ^ Math::Prime::Util Perl module with primality tests including BPSW
  22. ^ Math::Prime::Util::GMP Perl module with primality tests including BPSW, using C+GMP
  23. ^ NZMATH Archived 2013-01-17 at the Wayback Machine number theory calculation system in Python
  24. ^ "SymPy". SymPy - A Python library for symbolic mathematics.
  25. ^ GNU MP 6.2.0 Prime Testing Algorithm documentation for GMPLIB.
  26. ^ Magma Computational Algebra System - Primes and Primality Testing documentation for Magma.
  27. ^ Albrecht, Martin R.; Massimo, Jake; Paterson, Kenneth G.; Somorovsky, Juraj (15 October 2018). Prime and Prejudice: Primality Testing Under Adversarial Conditions (PDF). ACM SIGSAC Conference on Computer and Communications Security 2018. Toronto: Association for Computing Machinery. pp. 281–298. doi:10.1145/3243734.3243787.

Further reading

Read other articles:

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Crusade Forgotten Realms novel – news · newspapers · books · scholar · JSTOR (June 2019) (Learn how and when to remove this template message) For other books, see Crusade (disambiguation) § Literature. 1991 fantasy novel by James Lowder Crusade Cover...

 

ويليامز ليك   الإحداثيات 52°08′30″N 122°08′30″W / 52.141666666667°N 122.14166666667°W / 52.141666666667; -122.14166666667  [1] تقسيم إداري  البلد كندا[2][3]  التقسيم الأعلى كاريبو آ، كولومبيا البريطانية  خصائص جغرافية ارتفاع 586 متر  عدد السكان  عدد السكان 10753 (2016)[4]...

 

French Catholic priest (1943–2021) The Very ReverendPaul AulagnierDistrict Superior of the Society of Saint Pius X in central France(1976-1994)Aulagnier in 2020Personal detailsBorn(1943-05-25)25 May 1943Ambert, Vichy FranceDied6 May 2021(2021-05-06) (aged 77)Périgueux, FranceNationalityFrench Paul Aulagnier (25 May 1943 – 6 May 2021) was a French Traditionalist Catholic priest. Once a member of the Society of Saint Pius X, he then became one of the principal founders of the Institut...

Pemilihan umum Bupati Sleman 2015201020209 Desember 2015Kandidat   Calon Sri Purnomo Yuni Satia Rahayu Partai PAN PDI-P Pendamping Sri Muslimatun Danang Wicaksana Sulistya Suara rakyat 297.267 225.338 Persentase 56,66% 43,34% Peta persebaran suara Peta lokasi Sleman Bupati dan Wakil Bupati petahanaSri Purnomo dan Yuni Satia Rahayu PAN Bupati dan Wakil Bupati terpilih Sri Purnomo dan Sri Muslimatun PDIP Pemilihan umum kepala daerah diselenggarakan pada tanggal 9 Desember 2015 untuk ...

 

Si ce bandeau n'est plus pertinent, retirez-le. Cliquez ici pour en savoir plus. Cet article ne cite pas suffisamment ses sources (septembre 2022). Si vous disposez d'ouvrages ou d'articles de référence ou si vous connaissez des sites web de qualité traitant du thème abordé ici, merci de compléter l'article en donnant les références utiles à sa vérifiabilité et en les liant à la section « Notes et références ». En pratique : Quelles sources sont attendues ?...

 

Cisleithania (merah) di Austria-Hungaria. Cisleithania (Jerman: Cisleithaniencode: de is deprecated , juga disebut Zisleithanien, bahasa Hongaria: Ciszlajtánia, bahasa Ceska: Předlitavsko, bahasa Slowakia: Predlitavsko, bahasa Polandia: Przedlitawia, Kroasia: Cislajtanijacode: hr is deprecated , bahasa Slovenia: Cislajtanija, bahasa Rumania: Cisleithania, Ukraina: Цислейтанія, transliterasi: Tsysleitàniia) adalah nama yang umum digunakan untuk wilayah...

This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Recycling by material – news · newspapers · books · scholar · JSTOR (March 2022) (Learn how and when to rem...

 

Mainline route in the British railway system This article is about the railway route. For the main operator of services on the route, see Govia Thameslink Railway. For other uses, see Thameslink (disambiguation). ThameslinkGovia Thameslink Railway Class 700 Desiro City standing at Brighton in December 2020.OverviewLocaleSouth East EnglandGreater LondonEast of EnglandPredecessor Thameslink, 2 March 1997 – 31 March 2006 First Capital Connect, 1 April 2006 – 13 September 2014 Current operato...

 

这是马来族人名,“尤索夫”是父名,不是姓氏,提及此人时应以其自身的名“法迪拉”为主。 尊敬的拿督斯里哈芝法迪拉·尤索夫Fadillah bin Haji YusofSSAP DGSM PGBK 国会议员 副首相 第14任马来西亚副首相现任就任日期2022年12月3日与阿末扎希同时在任君主最高元首苏丹阿都拉陛下最高元首苏丹依布拉欣·依斯迈陛下首相安华·依布拉欣前任依斯迈沙比里 马来西亚能源转型与�...

Part of a series onAfrican Americans History Periods Timeline Atlantic slave trade Abolitionism in the United States Slavery in the colonial history of the US Revolutionary War Antebellum period Slavery and military history during the Civil War Reconstruction era Politicians Juneteenth Civil rights movement (1865–1896) Jim Crow era (1896–1954) Civil rights movement (1954–1968) Black power movement Post–civil rights era Aspects Agriculture history Black Belt in the American South Busi...

 

Submarine communications cable system Southern Cross CableCable typeFibre-opticFateActiveConstruction beginning1999Construction finished2000First traffic2000Design capacity>20 Tbit/s (Jan 2020, based on 100G+ Technology)Lit capacity92 Tbit/s (2023)Built byAlcatel-Lucent/FujitsuArea servedSouthern Pacific, US Pacific coastOwner(s)Southern Cross Cables Limited (Spark, Singtel/Optus, Telstra, Verizon Business)Websitewww.southerncrosscables.com The route of the cables. The blue are s...

 

International hotel operator Minor HotelsCompany typeSubsidiaryIndustryHospitalityFounded1978; 46 years ago (1978)FounderWilliam HeineckeHeadquartersBangkok, ThailandNumber of locations550 (2024)Area servedWorldwideKey peopleWilliam Heinecke(Chairman)Dillip Rajakarier(CEO)Brands Anantara Hotels & Resorts Avani Hotels & Resorts Elewana Collection Oaks Hotels, Resorts & Suites NH Hotels NH Collection nhow Hotels Tivoli Hotels & Resorts ParentMinor International...

Study of environmental issues, nature and culture Environment Human impact on the climate Issues Environmentalism Stewardship Environmental studies Environment in Consulting Education Engineering Humanities Law Policy Science Social science Article index Lists Portal Category Commonsvte The environmental humanities (also ecological humanities) is an interdisciplinary area of research, drawing on the many environmental sub-disciplines that have emerged in the humanities over the past several d...

 

Italian middle-distance runner Francesco PerniciPernici at Budapest 2023Personal informationNational teamItalian TeamBorn (2003-02-18) 18 February 2003 (age 21)Esine, ItalyHeight1.78 m (5 ft 10 in)Weight59 kg (130 lb)SportSportAthleticsEvent800 mClubG.S. Fiamme GialleCoached byDalmazio BersiniAchievements and titlesPersonal best 800 m: 1:45.23 (2023) Medal record Men's athletics Representing  Italy European U20 Championships 2021 Tallinn 4×400 m]] Fran...

 

American photographer and musician (1941–1998) For the food brand founded by McCartney, see Linda McCartney Foods. Linda McCartneyMcCartney in 1976BornLinda Louise Eastman(1941-09-24)September 24, 1941Manhattan, New York, U.S.DiedApril 17, 1998(1998-04-17) (aged 56)Tucson, Arizona, U.S.Occupations Photographer musician vegetarian cook book author activist Years active1965–1998Spouses Melville See Jr. ​ ​(m. 1962; div. 1965)​ Paul M...

American college basketball season This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.Find sources: 2023–24 Omaha Mavericks women's basketball team – news · newspapers · books · scholar · JSTOR (February 2024) 2023–24 Omaha Mavericks women's basketballConferenceSummit LeagueRecord8–23 (3–13 The Summit)Head&...

 

女性主義 女性 女孩 女性气质 历史 社会史 女性历史 女权主义者历史(英语:Feminist history) 女性主義歷史 年表 女性参政权年表(英语:Timeline of women's suffrage) 各国女性參政權 澳大利亚(英语:Suffrage in Australia) 日本(英语:Women's suffrage in Japan) 科威特(英语:Women's suffrage in Kuwait) 新西兰(英语:Women's suffrage in New Zealand) 瑞士(英语:Women's suffrage in Switzerland) 英�...

 

Welcome to my talk page. Please adhere to the talk page guidelines and particularly the following: Please post your new topic at the bottom of this page. Please sign and date your entry by inserting ~~~~ at the end. Please specify a descriptive subject or headline for a new topic and separate subtopics by ===heading=== lines, if needed. Please indent your posts with one more : than what you are replying to, i.e. begin with : if replying to an existing topic and :: if replying to a reply. I w...

あわらし あわら市 芦原温泉市庁舎位置 あわら市旗 あわら市章 国 日本地方 中部地方(北陸地方)都道府県 福井県市町村コード 18208-7法人番号 4000020182087 面積 116.98km2総人口 26,187人 [編集](推計人口、2024年9月1日)人口密度 224人/km2隣接自治体 坂井市石川県加賀市市の木 梅市の花 花菖蒲市の鳥 白鷺あわら市役所市長 [編集]森之嗣所在地 〒919-0692福井県あわら市市姫...

 

جامع العسافي في شارع الضباط راغبة خاتون تعتبر منطقة راغبة خاتون من المناطق العريقة في بغداد، وسميت نسبة إلى السيدة راغبة التي كانت ذات نفوذ كبير وتملك الأراضي في المنطقة. ومنطقة راغبة خاتون هي جزء من قضاء الأعظمية، وتضم أجزاء من حي الشماسية وحي المغرب، وفيها العديد من المس...