This post is the continuation of this previous post. In this post, we discuss a deterministic primality proving algorithm that uses the least strong pseudoprimes to several prime bases. After describing the test, we present several examples.
The previous post discusses the notion of witness for the strong probable prime test (the MillerRabin test). One important characteristic of the strong probable prime test is that for any composite number, there is always at least one witness (in fact lots of them). This means that the strong probable prime test is not going to be tripped up on a Carmichael number like it is for the Fermat test.
When there is a guarantee that every composite number has a witness for its compositeness, it makes sense to talk about the least witness for a composite number . The statement that is equivalent to the statement that is a strong pseudoprime to all the bases less than or equal to . Strong pseudoprimes to base 2 are rare. Strong pseudoprimes to multiple bases are even rarer. According to [2], there are only 13 numbers below that are strong pseudoprimes to all of the bases 2, 3 and 5. Thus it is rare to have composite numbers whose . Because they are rare, knowing about strong pseudoprimes can help us find the primes.
The test in question comes from [1]. It had been improved and sharpened over the years. The paper [1] seems to contain the best results to date regarding this test. To see how the method evolved and got improved, any interested reader can look at the references provided in [1]. Let be the least strong pseudoprime to all of the first prime bases. The paper [1] presents the following 11 least strong pseudoprimes.

2047
1373653
25326001
3215031751
2152302898747
3474749660383
341550071723321
3825123056546413051
To illustrate, the number 25326001 is the smallest strong pseudoprime to all the bases 2, 3 and 5. For any odd number less than 25326001, check whether is a strong probable to these 3 bases. If it is, then has to be prime. Otherwise, is a strong pseudoprime to bases 2, 3 and 5 that is less than 25326001! Of course, if happens to be not a strong probable prime to one of the 3 bases, then it is a composite number.
The test using represents a primality test that actually proves primality rather than just giving strong evidence for primality. Using , the test only requires modular exponentiations. This test is a limited test since it only applies to numbers less than . However, it is interesting to note that the notions of strong probable primes and strong pseudoprimes give a deterministic primality test (though limited) that is fast and easy to use in addition to the usual MillerRabin probabilistic primality test.
___________________________________________________________________
Examples
Example 1
Consider the number 2795830049. This number is below . So we check for probable primality of to the bases 2, 3, 5, and 7. First of all, where 87369689. Here’s the calculation.
Note that the first term that is a 1 in the above sequence is . The preceding term is a 1. Thus 2795830049 is a strong probable prime to base 2. Now the base 3 calculation.
Note that the first term that is a 1 in the above sequence is the last term . The preceding term is a 1. Thus 2795830049 is a strong probable prime to base 3. Now the base 5 calculation.
The base 7 calculation.
Both the base 5 and base 7 calculations show that 2795830049 is a strong probable prime to both bases. The calculations for the 4 bases conclusively prove that 2795830049 is a prime number.
Example 2
Consider the number 62834664835837. This number is below . So we check for probable primality to the bases 2, 3, 5, 7, 11, 13, and 17. First, where 15708666208959.
__________________
__________________
__________________
__________________
__________________
__________________
The calculation for all bases shows that 62834664835837 is a strong probable primes to all 7 prime bases. This shows that 62834664835837 is prime.
Example 3
Consider the number 21276028621. This is a 11digit number and is less than . The algorithm is to check for the strong probable primality of to the first 5 prime bases – 2, 3, 5, 7, 11. First, where 5319007155.
__________________
__________________
__________________
Things are going well for the first 3 prime bases. The number 21276028621 is a strong pseudoprime to the first 3 prime bases. However, it is not a strong probable prime to base 7. Thus the number is composite. In fact, 21276028621 is one of the 13 numbers below that are strong pseudoprimes to bases 2, 3 and 5.
___________________________________________________________________
Exercises
Use the least strong pseudoprime primality test that is described here to determine the primality or compositeness of the following numbers:
 58300313
 235993423
 1777288949
 40590868757
 874191954161
 8667694799429
 1250195846428003
___________________________________________________________________
Reference
 Yupeng Jiang, Yingpu Deng, Strong pseudoprimes to the first 9 prime bases, arXiv:1207.0063v1 [math.NT], June 30, 2012.
 Pomerance C., Selfridge J. L., Wagstaff, S. S., The pseudoprimes to , Math. Comp., Volume 35, 10031026, 1980.
___________________________________________________________________