Fast Primality Testing for Integers That Fit into a Machine Word

Michal Forisek, Jakub Jancina
2015 Conference on Current Trends in Theory and Practice of Informatics  
For large integers, the most efficient primality tests are probabilistic. However, for integers with a small fixed number of bits the best tests in practice are deterministic. Currently the best known tests of this type involve 3 rounds of the Miller-Rabin test for 32-bit integers and 7 rounds for 64-bit integers. Our main result in this paper: For 32bit integers we reduce this to a single computation of a simple hash function and a single round of Miller-Rabin. Similarly, for 64-bit integers
more » ... can reduce the number of rounds to two (but with a significantly large precomputed table) or three. Up to our knowledge, our implementations are the fastest one-shot deterministic primality tests for 32-bit and 64-bit integers to date. We also provide empirical evidence that our algorithms are fast in practice and that the data segment is roughly as small as possible for an algorithm of this type. The research is partially funded by the VEGA grant V-12-031-00. 1 Here, Õ(f (n)) formally denotes the class k O(f (n) log k f (n)).
dblp:conf/sofsem/ForisekJ15 fatcat:sgkxx7nx6jaedo3ftkgwa5i5fm