Primality tests like the Fermat test and the Miller-Rabin test
rely on so-called "witnesses." In the case of Fermat, if a^{p-1} = 1 (mod p)
, for some a
, then p
is probably prime. The
a
is called a Fermat witness. However, if a composite passes the test for a given a
, then a
is called a Fermat liar.
The same principle holds for Miller-Rabin, although the equation is slightly more complicated.
Which numbers are the most honest? Which ones are the most lying?
Run racket main.rkt
to produce a bunch of heat maps that show the most honest (dark) and most lying (bright) numbers.
This one shows for the numbers 2 to 1024: