Use a Miller-Rabin test instead of a Fermat test; add comments