Section 12.4 Strong Pseudoprimes
ΒΆSince composite numbers can pass Miller's test too, nomenclature can get frustrating if we don't organize. So we come up with another name.Definition 12.4.1.
We call a composite number n that passes Miller's test base a a strong pseudoprime base a.
Theorem 12.4.2.
If n is a pseudoprime base 2, then 2nβ1 is a strong pseudoprime base 2.
Proof.
Let \(n\) be composite and odd, but it passes the base two test:
Since \(n\) is odd, we can cancel \(2\) in the congruence, and get
Rewrite this as \(2^{n-1}-1=nk\) for some integer \(k\text{.}\)
Since \(2^{n-1}-1\) is odd, then so is \(k\) necessarily. Now comes some final manipulation to prepare to apply Miller's test to \(2^n-1\text{:}\)
Now use the preceding equation as the exponent in Miller's test and a clever reduction:
Since \([(2^n-1)-1]/2=2^{n-1}-1\) is odd, the number passes Miller's test.
All that remains is to show \(2^n-1\) is composite if \(n\) is composite; this is a fairly straightforward extension of Lemma 12.1.2 (see Exercise 12.7.7).
Corollary 12.4.3.
If n is a pseudoprime base a, so is 2nβ1. (This is Fact 12.2.6.)
Proof.
All we need is that \((\pm 1)^2=1\text{.}\)
Corollary 12.4.4.
There are infinitely many strong pseudoprimes (and hence pseudoprimes) base 2.
Proof.
Take your favorite pseudoprime, and keep subtracting one from two to the power of the previous (strong) pseudoprime.
Example 12.4.5.
For instance, we now know that 2341β1 must fall in that category. If you try the cell below you will see that the (very large) second number is odd, which confirms it.
xxxxxxxxxx
n=2^341-1
print(mod(2,n)^((n-1)/2))
print((n-1)/2)
Theorem 12.4.6.
If n is an odd composite positive integer, then n passes Miller's test for at most (nβ1)/4 bases a between 1 and nβ1.
Algorithm 12.4.7. Miller-Rabin (probabilistic) primality test.
Run Miller's test for k different bases less than nβ1. If a number passes all of them, the probability of failure is less than (14)k.
xxxxxxxxxx
(1./4)^100
xxxxxxxxxx
p=next_probable_prime(randrange(2^1024))
q=next_probable_prime(randrange(2^1024))
n=p*q
pretty_print(html(p))
pretty_print(html(q))
pretty_print(html(n))
xxxxxxxxxx
p=next_probable_prime(randrange(2^1024))
%time is_prime(p)
Sage note 12.4.8. Reminder about timing.
Don't forget, you could use %time is_prime(p)
to time this operation in a worksheet or Sage command line.