Carl Kingsford
April 27, 2000
Q: No questions really, just theorems I had to accept with no proofs. Where can I find proofs of those theorems?
A: Most of the material covered is the the textbook. Pollard Rho factorization (day 1) is covered in section 3.5 (156-159). Pseudoprimes and the Miller-Rabin test for primality (day 2) are covered in section 5.2 (192-200). The theorems that I skipped for time sake were theorems 5.9, 5.10, 5.12. There are proofs for these in the book. Theorem 5.11 concerning the effectiveness of Rabin's Probabilistic Primality Test has no formal proof in the book, but the result follows obviously from Theorem 5.10.
Q: In the theorem for testing and constructing Carmichael numbers
(THM 5.7), we let
where they are all distinct
primes. Can the qi's be prime powers? I.e. can a Carmichael number
look like
?
A: The short answer is no. All Carmichael numbers are of the form
where the qi's are all distinct primes. For
the longer answer, we ask: why is this so?
Well, the proof of that theorem breaks down if the qi's aren't distinct. In that theorem, we construct a set of congruence equations
![]()
![]()
For example:
. We see that (3-1)|3320 and
(41-1)|3320 so except for being distinct the conditions of the
theorem are satisfied, but
.
Q: If a number is a pseduoprime with base 2, is it a pseudoprime
with a base of any number? I.e. if n is not prime, but
does it follow that
A: Not necessarily. For example,
so 561
is a pseudoprime to the base 2, but
so it is not a pseduoprime to the base 3.
Some numbers as pseudoprimes to several bases, some numbers are pseudoprimes to all bases (these are the Carmichael numbers) and some are of course not pseudoprimes at all.
Q: Is there any particular base or group of bases which is more likely to work with ``mostly all of the different theorems'' relating to pseudoprimes? If so, what is it and why? If not, why not?
A: To be a bit more specific, let's consider the question ``is there a base or group of bases for which fewer numbers are pseudoprimes to that base?'' On one level, the answer to this question is no, because as we showed in class, there are an infinite number of pseudoprimes to base 2, and this result generalizes to any base. Hence, if we pick any base, there will be an infinite set of numbers that slip by.
But that doesn't consider density. Suppose that for base 2, pseudoprimes come along about every 500 numbers, but for base 13 we find them only every million numbers. Then base 13 might be a better choice. (These figures have no basis in reality; they are for example only.) As far as I know, no one has investigated the relative densities of pseudoprimes to different bases. I calculated all the psuedoprimes to the base 2,3,5,13,17,19,23,27 below 50,000. The table below summarizes how many pseudoprimes to each base there are below 50,000:
| base: | 2 | 3 | 5 | 13 | 17 | 19 | 23 | 27 |
| # | 55 | 53 | 54 | 68 | 63 | 93 | 110 | 119 |
For Miller's test, we have an upper bound on the density of strong
pseudoprimes to the base b. From THM 5.10, we know that n is a
strong pseudoprime (that is passes Miller's test) for no more than
(n-1)/4 bases b, where
. So the probability
that a number is a strong pseudoprime to the base b is less than
1/4.
The idea of density is really important when you consider that most
work with factoring is done on computers with limited
precision. That means that they can only represent numbers up to
some fixed size.
If we know that for some base, due to its low density,
there are only, say, 5 pseudoprimes to that base among the integers
that we can represent then that base might be very useful. We could
even compute and remember those 5 integers and check against them
when testing for primality. In fact, as stated in the textbook
(p. 197) the only odd integer that passes Miller's test for all
bases 2, 3, 4, and 7 less than
is 3215031751.
Another practical consideration is the calculation involved. Since
to test if something is a pseudoprime (or to apply Miller's test
for primality), we have to compute
we don't want
the base to be too large, since squaring a big base is more work
than squaring a little base. Also, since modern computers work in
base 2, it is simple to manipulate powers of 2. For example, 2
would be represented in the computer as
. To
compute 25 simply means shifting the 1 bit over 4 places:
![]()
Q: Are there fewer Carmichael numbers or strong pseudoprimes?
A: We showed in class there are infinitely many strong pseudoprimes to any base (THM 5.9). THM 5.7 on constructing Carmichael numbers is a fundamental component in the proof that there are infinitely many Carmichael numbers. (That proof by Alford, Granville, and Pomerance in 1992 is very complicated.) Hence both sets are infinite.
Which set is less than the other in cardinality? [The cardinality of both sets is the same; they are countably infinite (cardinality = aleph-null), the same as the integers.]
Given a Carmichael number c, we know that it is a pseudoprime to base 2. In the proof of THM 5.9 (pg. 196-197) we showed that if n is a pseudoprime to the base 2, then N = 2n - 1 is a strong pseudoprime to the base 2. So, define g from the Carmichael numbers to the strong pseudoprimes to the base 2 by g(n) = 2n - 1. Clearly g is one-to-one. Also, 1373653 is a strong pseudoprime to the base 2, but
220 = 1048576 < 1373653 < 209752 = 221
so 1373653 is not of the form 2n - 1 so g is not onto. Hence there are fewer Carmichael numbers than strong pseduoprimes.
Q: Can a number be both a Carmichael number and a strong pseudoprime? I.e. does the set of strong pseudoprimes intersect the set of Carmichael numbers?
A: Yes. In fact
is both a Carmichael
number and a strong pseudoprime to the base 3. We can see that it
is a Carmichael number because 6|8910, 18|8910, and
66|8910. It is a strong pseudoprime to the base 3 because
. So in Miller's test,
and
. In fact, the table below lists all the Carmichael
numbers less than 200,000 which are also strong pseudoprimes to the
bases 2,3,5, and 6:
| 2 | 3 | 5 | 6 |
| 15841 | 8911 | none | 46657 |
| 29341 | 10585 | 115921 | |
| 52633 |
Q: When talking about the Pollard Rho factorization method
we were calculating the random number sequence by calculating
. What is the significance of
calculating it
and finding the loop in the
?
A: Recall the Pollard Rho algorithm:
Remember in the picture of the
there is a first place were the
values repeat (after the ``stem''). Call this place xi. Suppose we
(by some magical power) knew d from above. Let j be the next index
where
. Then we know that the length of the
loop is j-i so if we pick any xq and xr such that
then ![]()
So let s be the smallest multiple of (j-i) that is > i. That
means that xs is in the loop (since s > i) and we know that
since s is a multiple of j-i. Then
by our discussion above,
.
When we compute (x2k - xk, n) = d and get a non-trivial GCD, we
know that d | (x2k - xk) in other words,
. So when we compute (x2k - xk, n) = d we are
looking for a d and that search is motivated by the idea that
if we have a loop, then (x2k - xk, n) = d for some x2k -
xk.
The idea of the expanding ``lasso'' is simply this search. Since the
x2ks and the xks get farther and farther apart as k grows,
we are trying to make them equivalent
. For example,
suppose the length of the loop were 100. Then when k=3, xk and
x2k are very near each other and they could not possibly be
equivalent, but as k grows, they will drift farther apart.
Note though, that the method is not perfect, because we don't use a real random sequence, we may not get a loop (or at least it may take us a long time).
function a = recmod(b,n,m) % % BASE CASE % a = 1; if( n == 0 ) return; end % % RECURSIVE CASE y = recmod(b, floor(n/2), m); if( mod(n,2) == 0 ) a = mod( (y^2), m ); else a = mod( (y^2)*b, m ); end; return;
b2<<103>>j+1t = (bt)2<<104>>j+1 = ((bt)2j)2
So, we compute value for the next j using the value for the previous j and save us some computation time.
function y = Millers( b, n )
% calculate t and s
fact = sort(factor( n - 1 ));
% We figure out how many 2s there are in the factorization
s = 0;
len = length( fact );
for k=1:len
if( fact(k) == 2 )
fact(k) = 1; % change the 2s to 1s
s = s + 1;
else
break;
end;
end;
t = prod( fact ); % we compute, since all 2 --> 1
% compute b^t mod n and check to see if it is 1 or -1:
bt = recmod( b, t, n );
if( bt == 1 | bt == n - 1 )
y = 1;
return;
end;
% We now check the second case of Miller's test. See the note
% above.
prev = bt;
for j=1:s-1
r = recmod( prev, 2, n );
if( r == n - 1 )
y = 1;
return;
end;
prev = r;
end;
y = 0; % it failed all tests
return;
This document was generated using the LaTeX2HTML translator Version 97.1 (release) (July 13th, 1997)
Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 -link 0 mth128s_quest.tex.
The translation was initiated by Joshua Holden on 4/27/2000