Fact-checked by Grok 2 weeks ago

Strong pseudoprime

In , a strong pseudoprime to base a is an composite n that satisfies the condition of the for that base. Specifically, write n-1 = 2^s d where d is and s \geq 1; then n is a strong pseudoprime to base a (with $1 < a < n and \gcd(a, n) = 1) if either a^d \equiv 1 \pmod{n} or a^{d \cdot 2^r} \equiv -1 \pmod{n} for some integer r with $0 \leq r < s. This definition captures composites that mimic primes under a strengthened version of Fermat's Little Theorem, distinguishing them from weaker Fermat pseudoprimes, which only satisfy a^{n-1} \equiv 1 \pmod{n}. The concept was introduced by Gary L. Miller in 1976 as part of a deterministic primality test relying on the extended Riemann hypothesis, where failure of the test for any base implies compositeness. In 1980, Michael O. Rabin reformulated it into a probabilistic algorithm, the Miller-Rabin test, by randomly selecting bases; if n passes for a randomly chosen base, it is a probable prime, with the error probability bounded by $1/4 per trial since an odd composite n is a strong pseudoprime to at most one-quarter of possible bases coprime to n. This makes the test highly efficient for large numbers, as multiple iterations reduce the chance of mistaking a composite for a prime to negligible levels (e.g., less than $4^{-k} for k trials). Strong pseudoprimes play a critical role in computational number theory and cryptography, where fast primality testing is essential for generating secure keys in systems like . They are rarer than ; for instance, the smallest strong pseudoprime to base 2 is 2047 ($23 \times 89), and numbers that are strong pseudoprimes to multiple bases (e.g., the first 12 ) are exceptionally sparse, with none known below $10^{13} for certain sets. Research continues on their distribution and construction, informing improvements in deterministic variants of the test for numbers up to specific bounds.

Introduction and Background

Historical Development

The development of the concept of strong pseudoprimes arose in the mid-1970s amid efforts to create efficient probabilistic primality tests that could reliably distinguish primes from composites, building on the limitations of earlier deterministic methods. In 1976, Gary L. Miller introduced a strong form of primality testing in his paper "Riemann's Hypothesis and Tests for Primality," where he proposed a test based on enhanced conditions derived from Fermat's Little Theorem, assuming the generalized Riemann hypothesis for polynomial-time performance; this laid the groundwork for identifying composites that mimic primes under stricter criteria, later termed strong pseudoprimes. The following year, in 1977, Robert M. Solovay and Volker Strassen published "A Fast Monte-Carlo Test for Primality," presenting a probabilistic algorithm using the Jacobi symbol to verify , which further advanced randomized testing and highlighted the need for robust pseudoprime detection to achieve low error probabilities. This work complemented by emphasizing practical implementations for large numbers, though it relied on different mathematical foundations. Early explorations during this era identified specific composite examples, such as 2047 = 23 × 89, recognized as the smallest strong pseudoprime to base 2, illustrating the challenges in test design. By 1980, Michael O. Rabin extended Miller's approach in "Probabilistic Algorithm for Testing Primality," transforming it into an unconditional probabilistic test known as the , which explicitly defined strong pseudoprimes as composites passing the refined conditions on the order of a base modulo n. This evolution addressed key shortcomings of Fermat-based tests, which could be fooled by —square-free composites satisfying a^{n-1} ≡ 1 mod n for all coprime a—by imposing additional constraints on the decomposition of n-1 = 2^s d, thereby significantly reducing the density of deceptive composites.

Role in Probabilistic Primality Testing

The Miller-Rabin primality test is a probabilistic algorithm used to determine whether an odd integer n > 2 is likely prime. To apply the test, first express n-1 = 2^s d where d is odd. Then, for a randomly chosen base a with $1 < a < n-1 and \gcd(a, n) = 1, compute a^d \mod n; if this equals 1 or -1, the test passes for that base. Otherwise, compute successive squares a^{d \cdot 2^r} \mod n for r = 1 to s-1, and the test passes if any equals -1 \mod n. If none satisfy these conditions, n is composite. A strong pseudoprime to base a is a composite number n that passes the for that specific a, thereby acting as a "liar" or non-witness that falsely suggests primality. These pseudoprimes highlight the test's limitations, as a single base may fail to detect compositeness, potentially leading to erroneous classifications in applications requiring reliable prime detection. The test's probabilistic nature stems from the fact that, for composite n, at least 75% of possible bases a serve as witnesses that correctly identify compositeness, bounding the error probability (the chance of mistakenly declaring a composite prime) at most $1/4 per trial. For k independent random bases, the overall error probability drops below $4^{-k}, making the test highly reliable with multiple iterations, though strong pseudoprimes underscore the need for this multiplicity to mitigate risks from deceptive bases. In cryptography, the Miller-Rabin test is essential for generating large primes needed in systems like , where key pair creation involves selecting random odd candidates and verifying their primality to ensure the modulus n = p q (with primes p, q) resists factorization. Multiple bases—typically 20 or more for 1024-bit keys—are employed to achieve negligible false positive rates, often below $2^{-80}, safeguarding against strong pseudoprimes that could compromise security if undetected. Recent advancements in 2025 have focused on enhancing 's detection of strong pseudoprimes, including an advanced approach presented at the that refines witness selection to improve accuracy without increasing computational overhead.

Definitions and Concepts

Formal Definition

A strong pseudoprime is defined in the context of probabilistic primality testing, particularly the . Specifically, an odd composite integer n > 2 is a strong pseudoprime to base a, where $2 \leq a < n and \gcd(a, n) = 1, if the following condition holds: write n - 1 = 2^s d with d odd and s \geq 1, then either a^d \equiv 1 \pmod{n} or a^{2^r d} \equiv -1 \pmod{n} for some integer r with $0 \leq r < s. Here, s denotes the largest integer such that $2^s divides n-1, and d = (n-1)/2^s is the odd part of n-1. This definition ensures that n mimics the behavior of a prime under the strong test criterion, passing it despite being composite. In contrast, the related notion of a to base a applies more broadly: an odd integer n > 2 with \gcd(a, n) = 1 is a to base a if it satisfies the above conditions. All odd primes are strong probable primes to every valid base a, while the composites that qualify are precisely the strong pseudoprimes to that base.

Relation to Fermat and Euler Pseudoprimes

A to base a is defined as an odd composite integer n > 1 with \gcd(a, n) = 1 satisfying a^{n-1} \equiv 1 \pmod{n}. This condition arises from , which guarantees the congruence for prime n, but the presence of such pseudoprimes demonstrates that the Fermat test alone cannot reliably distinguish primes from all composites. An Euler pseudoprime to base a strengthens the criterion by incorporating quadratic residuosity: an odd composite n > 1 with \gcd(a, n) = 1 satisfies a^{(n-1)/2} \equiv \left( \frac{a}{n} \right) \pmod{n}, where \left( \frac{a}{n} \right) denotes the Jacobi symbol. Based on Euler's criterion, this test detects more composites than the Fermat test, as every Euler pseudoprime is also a Fermat pseudoprime, though the reverse does not hold. Strong pseudoprimes refine these concepts further for use in probabilistic primality tests like the . An odd composite n > 1 is a strong pseudoprime to base a (with \gcd(a, n) = 1) if, writing n-1 = 2^s d where d is odd, either a^d \equiv 1 \pmod{n} or a^{2^r d} \equiv -1 \pmod{n} for some integer r with $0 \leq r < s. These partial exponent conditions ensure that every strong pseudoprime to base a is both a and an to base a, but neither converse holds; for instance, 1729 is an to base 2 yet fails the strong test for that base. Carmichael numbers serve as absolute Fermat pseudoprimes, satisfying the Fermat condition for every base a coprime to n. While some Carmichael numbers pass strong tests for specific bases, a strong analogue—passing the strong test for all a coprime to n—does not exist, as established by a theorem showing no such numbers can satisfy the required conditions across all bases.

Mathematical Properties

Key Properties

A strong pseudoprime n to base a satisfies the Fermat condition a^{n-1} \equiv 1 \pmod{n}, as the strong test requires either a^d \equiv 1 \pmod{n} (where d is the odd part of n-1) or a^{2^r d} \equiv -1 \pmod{n} for some $0 \leq r < s (with n-1 = 2^s d), and repeated squaring of the latter case yields the former at exponent n-1. The order of a modulo n divides n-1, since the Fermat condition holds, but the strong condition imposes additional constraints: the smallest exponent e such that a^e \equiv 1 \pmod{n} must align with the 2-adic structure of n-1, ensuring no early failure in the beyond the permitted -1. Strong pseudoprimes exhibit closure under products when the prime factors share compatible "signatures" in their Miller-Rabin behavior for the base a; specifically, if primes p and q both pass the strong test to a with the same sequence of Jacobi symbols or square root behaviors relative to their p-1 and q-1, their product pq will also be a strong pseudoprime to a. Damgård, Landrock, and Pomerance (1993) proved that the proportion of composites below x that are strong pseudoprimes to all of the first k prime bases is at most x^{-\delta} for some \delta > 0 depending on k, implying no such strong pseudoprimes exist below exponentially large bounds in k; for instance, explicit computations show none below $10^{12} for k=10. As composites, strong pseudoprimes lack primitive roots unless they are of the form $2, $4, p^k, or $2p^k for odd prime p, but even in those cases, the strong pseudoprime property contradicts the cyclic group structure required for a primitive root when the test passes spuriously. Recent tabulations confirm no strong pseudoprimes to the first 10 prime bases (2 through 29) exist below $10^{12}, with the smallest such number exceeding $10^{18}.

Strong Probable Primes and Witnesses

In the context of the Miller-Rabin primality test, an odd integer n > 2 is defined as a strong probable prime to base a (with $1 < a < n and \gcd(a, n) = 1) if n passes the test criterion for that base. All prime numbers satisfy this condition for every valid base a, whereas composite numbers that pass the test for a specific base are known as strong pseudoprimes to base a. This distinction allows the test to identify probable primes efficiently, with primes always succeeding and composites occasionally mimicking them for particular bases. A base a serves as a witness to the compositeness of n if n fails the for that base, thereby providing conclusive evidence that n is composite. In contrast, if n is composite but passes the test for base a, then a is termed a non-witness or liar, as it falsely suggests primality. For any composite n, at least some bases act as witnesses, ensuring that the test can detect compositeness with appropriate base selection. The proportion of witnesses among all valid bases exceeds $3/4 for any odd composite n > 1. When testing with multiple bases, a composite n possessing at least one witness among the chosen set will be correctly identified as composite. Universal strong pseudoprimes—composites that pass the test for all bases coprime to n—are extremely rare, with their existence limited to highly specialized constructions and none known in certain ranges that would impact practical applications. In the Miller-Rabin algorithm, selecting a set of small fixed bases such as 2, 3, 5, 7, 11, 13, 23 yields a deterministic test with error probability 0 for n < 3.825 \times 10^{18}, making it suitable for cryptographic purposes where high confidence is required. This zero error rate stems from the scarcity of composites that are strong pseudoprimes to all these bases simultaneously. A key theoretical result guarantees that, under the extended Riemann hypothesis, every composite n has a witness among the first O((\ln n)^2) bases, bounding the search space needed to find a detecting base and underscoring the test's efficiency even in worst-case scenarios.

Examples and Constructions

Notable Examples

One of the most notable examples of a strong pseudoprime is 2047, the smallest such number to base 2. This composite number factors as $2047 = 23 \times 89. For verification under the strong test, write n-1 = 2046 = 2^1 \times 1023, so s=1 and d=1023. The condition holds because $2^{1023} \equiv 1 \pmod{2047}, satisfying a^d \equiv 1 \pmod{n}. Another classic example is 121, the smallest strong pseudoprime to base 3. It factors as $121 = 11^2. Here, n-1 = 120 = 2^3 \times 15, so s=3 and d=15. The test passes since $3^{15} \equiv 1 \pmod{121}, meeting the requirement for r=0. Notably, this square illustrates that strong pseudoprimes need not be square-free. The number 15841 provides a significant example as the sixth strong pseudoprime to base 2 and the smallest Carmichael number that is also strong to this base. Its factorization is $15841 = 7 \times 31 \times 73. With n-1 = 15840 = 2^4 \times 990, s=4 and d=990, the condition is satisfied by $2^{990 \cdot 2^3} \equiv -1 \pmod{15841} (for r=3), demonstrating the test's behavior on multi-prime composites. The smallest Carmichael number, 561 = $3 \times 11 \times 17, serves as an example of a strong pseudoprime to certain bases despite failing for others, such as base 2. Specifically, it is strong to base 50: n-1 = 560 = 2^4 \times 35, s=4 and d=35, where $50^{35} \equiv 1 \pmod{561}. This highlights how Carmichael numbers can pass the strong test selectively, underscoring limitations in probabilistic testing.

Methods for Constructing Strong Pseudoprimes

One prominent method for constructing strong pseudoprimes is Arnault's approach from 1995, which generates that are strong pseudoprimes to a specified set of prime bases. The technique constructs n = p q, where p and q are distinct satisfying the (p - 1 divides n - 1 and q - 1 divides n - 1), while ensuring the strong probable prime condition holds for each base a in the set. Specifically, primes p and q are chosen such that the multiplicative order of a modulo p and modulo q aligns with the decomposition n - 1 = 2^s d (d odd), for example by arranging a^d ≡ 1 (mod p) and a^d ≡ -1 (mod q), or other combinations where a^{2^r d} ≡ -1 (mod p) for some 0 ≤ r < s, guaranteeing the condition lifts via the to hold modulo n. To construct strong pseudoprimes to multiple bases simultaneously, Jaeschke's 1993 method employs the to solve systems of simultaneous congruences on the orders of the bases modulo the prime factors of n. For a set of bases {a_1, ..., a_t}, prime factors p_i of n are chosen such that the order of each a_j modulo p_i divides the appropriate divisor of n - 1 = 2^s d to satisfy the strong condition for all j, with the CRT ensuring the combined system yields n passing the for all specified bases while remaining composite. This approach is particularly effective for finding the smallest such n to the first k prime bases. These methods demonstrate that there are infinitely many strong pseudoprimes to any fixed set of bases, as the order conditions can be satisfied by . However, the resulting numbers are sparse; for instance, exhaustive searches have identified all strong pseudoprimes of certain forms (like n = p q with q - 1 = k (p - 1)) below 10^{24} to the first ten prime bases, totaling only a few hundred, and no composite numbers are strong pseudoprimes to all bases coprime to n, as this would contradict the bound of at most 1/4 of bases established by .

Computational Results

Smallest Strong Pseudoprimes to Specific Bases

The smallest strong pseudoprimes to individual bases provide concrete examples of composites that can fool the for those bases, highlighting the need for multiple bases in deterministic variants. Exhaustive computations have identified these values for bases up to 31, with the results tabulated in early works on the topic. These small n are typically products of small primes and illustrate how even simple composites can pass the test for specific a. The following table summarizes the smallest odd composite n that is a strong pseudoprime to base a for a = 2 to 11, including their prime factorizations. For bases 12 to 31, similar computational searches yield small values (often under 10,000), but they are less frequently tabulated for non-prime a; for prime bases up to 31, the values are confirmed by cross-referencing lists of strong pseudoprimes to multiple bases.
Base aSmallest nPrime factors
2204723 × 89
312111²
434111 × 31
578111 × 71
62177 × 31
725
89
9917 × 13
109
111337 × 19

Density and Distribution Estimates

The number of strong pseudoprimes to a fixed base a > 1 below x is known to be subpolynomial in x, specifically o(x / \log x), with computational evidence showing much sparser distribution than Fermat pseudoprimes. For example, the number of strong pseudoprimes to base 2 below $10^n grows slowly: 488 below $10^8, 22,407 below $10^{12}, 8,646,507 below $10^{18}, and 24,220,195 below $10^{19}. Strong pseudoprimes to multiple bases are considerably rarer. For the first k prime bases, Jaeschke computed the smallest such numbers and showed that there are none below $3.8 \times 10^{10} for the first seven primes (2, , 5, , 11, , 17). These results were extended in subsequent work; for instance, Zhang et al. tabulated all strong pseudoprimes below $10^{24} to the first ten prime bases (2 through 29), finding only a handful of such numbers, all of the form pq with distinct odd primes p, q. The density of strong pseudoprimes among composite numbers below x is o(1 / \ln x), which underscores the effectiveness of the Miller-Rabin test using multiple bases, as the error probability decreases rapidly. This low density arises because strong pseudoprimes form a proper of , whose count is already sublinear relative to the total number of composites \sim x. Constructions exist demonstrating that there are infinitely many strong pseudoprimes to any fixed a > 1. One such method involves taking a m to a and multiplying by a suitable prime p such that the of a p aligns appropriately with the strong condition.

References

  1. [1]
    Strong Pseudoprime -- from Wolfram MathWorld
    A strong pseudoprime to a base a is an odd composite number n with n-1=d·2^s (for d odd) for which either a^d=1 (mod n) (1) or a^(d·2^r)=-1 (mod n) (2) for ...
  2. [2]
    [PDF] Strong pseudoprime
    In number theory, a strong pseudoprime is a composite number that passes a primality test. All primes pass this test, but a small fraction of composites ...
  3. [3]
    [PDF] Riemann's Hypothesis and Tests for
    INTRODUCTION. Two classic computational problems are finding efficient for: (1) testing primality (deciding whether an integer is prime or composite), ...
  4. [4]
    Probabilistic algorithm for testing primality - ScienceDirect.com
    We present a practical probabilistic algorithm for testing large numbers of arbitrary form for primality. The algorithm has the feature that when it ...
  5. [5]
    [PDF] the miller–rabin test - keith conrad
    Miller–Rabin nonwitness for n, n is called a strong pseudoprime to base a. We won't use these terms here. Page 3. THE MILLER–RABIN TEST. 3 is (26424,29340) ...
  6. [6]
    Strong Pseudoprimes to Twelve Prime Bases - ResearchGate
    Aug 9, 2025 · ... historical background of analytic and algebraic number theory woven throughout. Topics include methods of solving binomial congruences, a ...
  7. [7]
    A Fast Monte-Carlo Test for Primality
    SIAM J. COMPUT. Vol. 6,No. 1, March 1977. A FAST MONTE-CARLO TEST FOR PRIMALITY*. R. SOLOVAY'I" AND V. STRASSEN:I: Abstract, Let n be an odd integer. Take a ...
  8. [8]
  9. [9]
    Rabin-Miller Strong Pseudoprime Test -- from Wolfram MathWorld
    Rabin-Miller Strong Pseudoprime Test. A primality test that provides an efficient probabilistic algorithm for determining if a given number is prime. It is ...
  10. [10]
    [PDF] The Miller-Rabin Randomized Primality Test - CS@Cornell
    It is called the Miller-Rabin primality test because it is closely related to a deterministic algorithm studied by Gary Miller in 1976. This is still the ...
  11. [11]
    [PDF] Notes on Primality Testing And Public Key Cryptography Part 1
    Around 1976, Gary Miller showed that W(n) = O((lnn)2), assuming that the Extended Riemann Hypothesis (for short ERH) holds. Then, Bach (1985) proved that W ...
  12. [12]
    <p>'Taylor' Miller Rabin</p> - American Mathematical Society
    In this presentation, I explore an advanced approach to the Miller-Rabin test in order to improve its accuracy in detecting strong pseudoprimes. My ...Missing: improvements 2023-2025
  13. [13]
    [PDF] The Rabin-Miller Primality Test - Sandiego
    Rabin-Miller pseudoprimes are called strong pseudoprimes. There are fewer strong pseudoprimes than Fermat or Euler pseudoprimes.
  14. [14]
    [PDF] Properties Of Strong Pseudoprimes On Base b - IJCRT
    This completes the proof. We know that every Euler pseudoprime is a pseudoprime. Next we show that every strong pseudoprime is an Euler pseudoprime.
  15. [15]
    A001262 - OEIS
    Sep 30, 2025 · Strong pseudoprimes to base 2. 79. 2047, 3277, 4033, 4681, 8321, 15841, 29341, 42799, 49141, 52633, 65281 ...
  16. [16]
    [PDF] The Pseudoprimes to 25 109 - Dartmouth Mathematics
    The defining of Euler and strong pseudoprimes were attempts to formulate a quick test for primality which never fails, or, at least, has a shorter list of ...<|control11|><|separator|>
  17. [17]
    Strong Carmichael numbers
    A strong Carmichael number N would be such that (2) holds for all bases a prime to N. In this note we show that such numbers do not exist. THEOREM. NO ...
  18. [18]
    On Strong Pseudoprimes to Several Bases - jstor
    Proposition 1 serves on the one hand for constructing strong pseudoprimes to several bases by multiplying primes which have identical signatures, and on the ...Missing: citation | Show results with:citation
  19. [19]
    [PDF] Carl Pomerance, JL Selfridge, Samuel S. Wagstaff, Jr.
    Nov 24, 2002 · In this case we determine the primes p for which p 1 divides n 1. ... Some Theorems About Strong Pseudoprimes and Euler Pseudo primes. THEOREM 1.
  20. [20]
    Finding strong pseudoprimes to several bases - ResearchGate
    Aug 9, 2025 · In this paper we tabulate all strong pseudoprimes (spsp's) n<10 24 to the first ten prime bases 2,3,⋯,29, which have the form n=pq with p,q odd ...
  21. [21]
    on strong pseudoprimes to several bases
    GERHARD JAESCHKE. Abstract. With y/k denoting the smallest strong ... ON STRONG PSEUDOPRIMES TO SEVERAL BASES. 919. Proposition 4. If p and q = 2p ...
  22. [22]
    [PDF] RIEMANN'S HYPOTHESIS AND TESTS FOR PRIMALITY
    Gary L. Miller. Department of Mathematics. University of California, Berkeley, California 94720. Abstract: The purpose of this paper is to present new upper ...Missing: 1976 | Show results with:1976
  23. [23]
    Prime Curios! 2047
    2047: This number is a composite. The smallest composite Mersenne number with a prime exponent (2 11 - 1 = 23 x 89). The smallest strong base-2 pseudoprime.
  24. [24]
    Prime Curios! 15841
    This number is a composite. + 15841 is the smallest Carmichael number which is also a Strong pseudoprime (base-2). [Gupta].
  25. [25]
  26. [26]
  27. [27]
    [PDF] On Strong Pseudoprimes to Several Bases - Gerhard Jaeschke
    Dec 22, 2004 · With ½ denoting the smallest strong pseudoprime to all of the first k primes taken as bases we determine the exact values for 5, 6, 41, Wg ...
  28. [28]
    [PDF] PSW PRIMALITY TEST? Carl Pomerance 1984
    Since n ≡ 3 mod 8 and each p|n is also ≡ 3 mod 8, it is easy to see that n will also be a strong base 2 pseudoprime. Since (5/n) = −1, since every prime p|n ...