Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a421eae95987cdd8

Jump to content

Strong pseudoprime

From Wikipedia, the free encyclopedia
(Redirected from Strong probable prime)

A strong pseudoprime is a composite number that passes the Miller–Rabin primality test. All prime numbers pass this test, but a small fraction of composites also pass, making them "pseudoprimes".

Unlike the Fermat pseudoprimes, for which there exist numbers that are pseudoprimes to all coprime bases (the Carmichael numbers), there are no composites that are strong pseudoprimes to all bases.

Motivation and first examples

[edit]

Let us say we want to investigate if n = 31697 is a probable prime (PRP). We pick base a = 3 and, inspired by Fermat's little theorem, calculate:

This shows 31697 is a Fermat PRP (base 3), so we may suspect it is a prime. We now repeatedly halve the exponent:

The first couple of times do not yield anything interesting (the result was still 1 modulo 31697), but at exponent 3962 we see a result that is neither 1 nor −1 (i.e. 31696) modulo 31697, proving 31697 is composite, and therefore not a strong pseudoprime to base 3. Modulo a prime, the residue 1 can have no other square roots than +1 and −1, but if the modulus is composite, 1 can have square root +1 modulo some factors and −1 modulo others, leading to additional possibilities.

In cases like this, where a number is a Fermat pseudoprime but not a strong pseudoprime, this even gives us a factorization: 31697 = gcd(28419+1, 31697) × gcd(28419−1, 31697) = 29 × 1093.

For another example, pick n = 47197 and calculate in the same manner:

In this case, the result continues to be +1 (mod 47197) until we reach an odd exponent. In this situation, we say that 47197 is a strong probable prime to base 3. Because it turns out this PRP is in fact composite (can be seen by picking other bases than 3), we have that 47197 is a strong pseudoprime to base 3.

Finally, consider n = 74593 where we get:

Here, we reach minus −1 modulo 74593, a situation that is perfectly possible with a prime. When this occurs, we stop the calculation (even though the exponent is not odd yet) and say that 74593 is a strong probable prime (and, as it turns out, a strong pseudoprime) to base 3.

Formal definition

[edit]

An odd composite number n = d · 2s + 1 where d is odd is called a strong (Fermat) pseudoprime to base a if:

or

(If a number n satisfies one of the above conditions and we don't yet know whether it is prime, it is more precise to refer to it as a strong probable prime to base a. But if we know that n is not prime, then we may use the term strong pseudoprime.)

The definition is trivially met if a ≡ ±1 (mod n) so these trivial bases are often excluded.

Guy mistakenly gives a definition with only the first condition, which is not satisfied by all primes.[1]

Properties of strong pseudoprimes

[edit]

A strong pseudoprime to base a is always an Euler–Jacobi pseudoprime, an Euler pseudoprime[2] and a Fermat pseudoprime to that base, but not all Euler and Fermat pseudoprimes are strong pseudoprimes. Carmichael numbers may be strong pseudoprimes to some bases—for example, 561 is a strong pseudoprime to base 50—but not to all bases.

A composite number n is a strong pseudoprime to at most one quarter of all bases below n;[3][4] thus, there are no "strong Carmichael numbers", numbers that are strong pseudoprimes to all bases. Thus given a random base, the probability that a number is a strong pseudoprime to that base is less than 1/4, forming the basis of the widely used Miller–Rabin primality test. The true probability of a failure is generally vastly smaller. Paul Erdős and Carl Pomerance showed in 1986 that if a random integer n passes the Miller–Rabin primality test to a random base b, then n is almost surely a prime.[5] For example, of the first odd natural numbers less than 25×109, there are 1,091,987,405 probable primes to base 2, but only 21,853 of them are pseudoprimes, and only 4,842 of those are strong pseudoprimes.[6]

However, there are infinitely many strong pseudoprimes to any base,[2] and there exist numbers which are strong pseudoprimes any desired set of bases. Arnault [7]: 157  gives a 397-digit Carmichael number that is a strong pseudoprime to every prime base less than 307.

One way to reduce the chance that such a number is wrongfully declared probably prime is to combine a strong probable prime test with a Lucas probable prime test, as in the Baillie–PSW primality test.

Examples

[edit]

The first strong pseudoprimes to base 2 are

2047, 3277, 4033, 4681, 8321, 15841, 29341, 42799, 49141, 52633, 65281, 74665, 80581, 85489, 88357, 90751, ... (sequence A001262 in the OEIS).

The first to base 3 are

121, 703, 1891, 3281, 8401, 8911, 10585, 12403, 16531, 18721, 19345, 23521, 31621, 44287, 47197, 55969, 63139, 74593, 79003, 82513, 87913, 88573, 97567, ... (sequence A020229 in the OEIS).

The first to base 5 are

781, 1541, 5461, 5611, 7813, 13021, 14981, 15751, 24211, 25351, 29539, 38081, 40501, 44801, 53971, 79381, ... (sequence A020231 in the OEIS).

For base 4, see (sequence A020230 in the OEIS), and for bases 6 to 100, see (sequence A020232 in the OEIS) to (sequence A020326 in the OEIS). By testing the above conditions to several bases, one gets somewhat more powerful primality tests than by using one base alone. For example, there are only 13 numbers less than 25·109 that are strong pseudoprimes to bases 2, 3, and 5 simultaneously;[2]: Table 7  the smallest such number is 25326001. This means that, if n is less than 25326001 and n is a strong probable prime to bases 2, 3, and 5, then n is prime.

Carrying this further, 3825123056546413051 is the smallest number that is a strong pseudoprime to the 9 bases 2, 3, 5, 7, 11, 13, 17, 19, and 23.[8][9] So, if n is less than 3825123056546413051 and n is a strong probable prime to these 9 bases, then n is prime.

By judicious choice of bases that are not necessarily prime, even better tests can be constructed. For example, there is no composite that is a strong pseudoprime to all of the seven bases 2, 325, 9375, 28178, 450775, 9780504, and 1795265022.[10]

Least strong pseudoprime to base a

[edit]
Least strong pseudoprime to base a
(sequence A298756 in the OEIS)
aSPSP aSPSP aSPSP aSPSP
193354565339749
2204734336665989
312135967339925
4341363568251009
5781379693510125
621738397069102133
7253913371910351
894039728510415
9914121739105451
10942451741510615
11133432175911079
1291449761510891
13854548177391099
14154697877110111
1516874765793911155
1615484980911265
1794925819111357
18255049829114115
1995125832111557
2021525184851169
21221539852111749
2221545586851189
231695598724711915
24255655888712091
25217572589912115
2695857909112265
27121591591912385
28960481929112425
2915611593251259
3049629949312625
3115635299518911279
3225649969512849

9, being the least odd composite number, is the least number which can be a pseudoprime, and shows up often because it is a strong pseudoprime to any base a ≡ ±1 (mod 9).

Overpseudoprime

[edit]

A composite c is called an overpseudoprime base b when the multiplicative order of b mod c × the number of cyclotomic coset (the coset {0} is not counted, e.g. for 2 mod 9 there are 2 cosets: {1, 2, 4, 8, 7, 5}, {3, 6}; for 2 mod 15 there are 4 cosets: {1, 2, 4, 8}, {3, 6, 12, 9}, {5, 10}, {7, 14, 13, 11}; and for 2 mod 21 there are 5 cosets: {1, 2, 4, 8, 16, 11}, {3, 6, 12}, {5, 10, 20, 19, 17, 13}, {7, 14}, {9, 18, 15}) of b mod c equals c[11][12][13], in fact, the overpseudoprimes base b are exactly the composite factors of the Zsigmondy numbers Zs(n,b,1) for some n. Overpseudoprimes must be strong pseudoprimes, Euler-Jacobi pseudoprimes, Euler pseudoprimes, and Fermat pseudoprimes to the same base b. There are infinitely many overpseudoprime to every base b.

Every prime p divides only finitely many (including zero) overpseudoprimes in base b, since for all bases b ≥ 2 and all n ≥ 1, there are only finitely many (prime or composite) numbers r such that the multiplicative order of b mod r is n (all of these r are divisors of Zs(n,b,1), of course there are only finitely many divisors of Zs(n,b,1)), and for base b ≥ 2 and prime p, p divides an overpseudoprime in base b if and only if p does not divide b and p is odd and p is not equal to the odd part (OEIS: A000265) of Zs(n,b,1) for any n.

The overpseudoprimes base 2 are

2047, 3277, 4033, 8321, 65281, 80581, 85489, 88357, 104653, 130561, 220729, 253241, 256999, 280601, 390937, 458989, 486737, 514447, 580337, 818201, 838861, 877099, 916327, 976873, ... (sequence A141232 in the OEIS)

The overpseudoprimes base 3 are

121, 703, 3281, 8401, 12403, 31621, 44287, 47197, 55969, 74593, 79003, 88573, 97567, 105163, 112141, 211411, 221761, 226801, 228073, 293401, 313447, 320167, 328021, 340033, 359341, 432821, 443713, 453259, 478297, 497503, ... (sequence A141350 in the OEIS)

The overpseudoprimes base 5 are

781, 1541, 5461, 13021, 15751, 25351, 29539, 38081, 40501, 79381, 100651, 121463, 133141, 195313, 216457, 315121, 318551, 319507, 326929, 341531, 353827, 375601, 416641, 432821, 453331, 464881, 498451, ... (sequence A141390 in the OEIS)

The overpseudoprimes base 10 are

9, 91, 4187, 6533, 8149, 10001, 11111, 50851, 79003, 83119, 94139, 102173, 118957, 148417, 158497, 166499, 201917, 226273, 237169, 287809, 341503, 351809, 413339, 455971, 463241, 481601, 491063, 497377, ... (sequence A400102 in the OEIS)

Least overpseudoprime to base a

[edit]
Least overpseudoprime to base a
aOPSPthe number n such that this OPSP divides Zs(n,a,1) aOPSPthe number n such that this OPSP divides Zs(n,a,1) aOPSPthe number n such that this OPSP divides Zs(n,a,1) aOPSPthe number n such that this OPSP divides Zs(n,a,1)
19–[note 1]3354546533297492
220471134331666519892
3121535926733199252
43415363516825410091
57815379169352101251
611111038392706911021333
725439156137192103511
8924039172854104152
991341212739110545110
1091425292274152106151
111333432117591610792
121336449276151108916
1385445481127739210991
141524691787711101112
1514041184765479391111551
16151484928092112654
17924925281913113572
182545049182911141152
19915125183212115571
20212525118485211692
212214539285211117496
22211545528685111891
2316965591872473119152
2425256551888711201191
252173572548992121151
26925857190912122654
271215591529191123854
2891608412892911124252
29152611519325412592
30493629294931126251
311516352922951891512791
32254649196951128493

The least overpseudoprime to base a equals the least strong pseudoprime to base a for most a, for a ≤ 1024, the exceptions are:

athe least overpseudoprime to base athe least strong pseudoprime to base a
61111217
1213391
15140411687
391561133
42529451
60841481
12011991
14413391
16015991
20420391
22021991
28514391
3031247247
322321247
330329133
345341301
40240391
41720991
470469217
47711991
495247217
510451301
51712991
53453391
590589133
591295259
670669427
67516991
69068991
75036191
79036191
816815247
825413133
83141591
840841703
867169133
870721341
873437133
903365341
93923591
945473341
954955481
96348191
97297391
102351191

Notes

[edit]
  1. ↑ Zsigmondy number Zs(n,a,1) is not defined for a = 1

References

[edit]
  1. ↑ Guy, Pseudoprimes. Euler Pseudoprimes. Strong Pseudoprimes. §A12 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 27-30, 1994.
  2. 1 2 3 Carl Pomerance; John L. Selfridge; Samuel S. Wagstaff Jr. (July 1980). "The pseudoprimes to 25·109" (PDF). Mathematics of Computation. 35 (151): 1003–1026. doi:10.1090/S0025-5718-1980-0572872-7. Archived (PDF) from the original on 2005-03-04. Retrieved 2013-03-03.
  3. ↑ Louis Monier (1980). "Evaluation and Comparison of Two Efficient Probabilistic Primality Testing Algorithms". Theoretical Computer Science. 12: 97–108. doi:10.1016/0304-3975(80)90007-9.
  4. ↑ Rabin, Michael O. (February 1980). "Probabilistic Algorithm for Testing Primality" (PDF). Journal of Number Theory. 12 (1): 128–138. doi:10.1016/0022-314X(80)90084-0.
  5. ↑ "Probable primes: How probable?". Archived from the original on October 26, 2020. Retrieved October 23, 2020.
  6. ↑ Caldwell, Chris. "The Prime Glossary: probable prime". The Prime Pages.
  7. ↑ Arnault, François (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.
  8. ↑ Zhang, Zhenxiang; Tang, Min (2003). "Finding Strong Pseudoprimes to Several Bases. II". Mathematics of Computation. 72 (244): 2085–2097. Bibcode:2003MaCom..72.2085Z. doi:10.1090/S0025-5718-03-01545-X.
  9. ↑ Jiang, Yupeng; Deng, Yingpu (2012). "Strong pseudoprimes to the first 9 prime bases". arXiv:1207.0063v1 [math.NT].
  10. ↑ "SPRP Records". Archived from the original on 11 October 2015. Retrieved 3 June 2015.
  11. ↑ Vladimir Shevelev, G. Garcia-Pulgarin, J. M. Velasquez and J. H. Castillo, Overpseudoprimes, and Mersenne and Fermat Numbers as Primover Numbers Archived 2024-06-04 at the Wayback Machine
  12. ↑ Vladimir Shevelev, Overpseudoprimes, Mersenne Numbers and Wieferich primes
  13. ↑ J. H. Castillo, G. García-Pulgarín and J. M. Velásquez-Soto, q-pseudoprimality: A natural generalization of strong pseudoprimality