Skip to content

A probable-prime test with a proven per-input error bound from anchored roots of unity

Alper Ferudun

math.NT

Abstract

We describe A4, a probabilistic primality test with one-sided error. A prime is never rejected. For every composite nn the answer "probable prime" has probability at most 2−e2^{-e} over the random choices of the test (independent, uniform and unknown to whoever chose nn), where e≥ke\ge k is computed from nn before any random choice and printed with the answer. The test takes roots of unity from the small prime factors of n−1n-1 and n+1n+1 that trial division finds, verifies with one or two fixed exponentiations that their orders are exact modulo every prime divisor of nn, and requires random elements of (Z/n)∗(\mathbb{Z}/n)^* and of a quadratic extension to project into the cyclic groups that these roots generate. From about 1000 bits on (for k=128k=128), one Frobenius condition settles composites with at most four prime factors, by the estimates of Damgård and Frandsen; for five or more, the logarithms of the verified orders, summed over the rounds, must reach k/4k/4. On 424 random primes of 512 to 8192 bits, drawn after the planner of version 1 was tuned, a decision with the proven bound 2−1282^{-128} cost 5.4 to 7.7 Miller-Rabin rounds on average, against 19 to 26 for Seysen's SQFT3 in the same arithmetic and 64 for Miller-Rabin itself; A4 was faster than SQFT3 on 423 of the 424 primes. Baillie-PSW, which has no proven bound, was 2 to 3 times faster than A4, and SQFT3 rejected products of two random primes slightly faster. Inputs whose n2−1n^2-1 has few small prime factors gain nothing. The ingredients are published; the contributions are their combination under one exponent proved for each input from the orders verified on both sides of nn, three refinements, their proofs, and measurements. The counting lemmas and the acceptance sets of the program were checked by exhaustive enumeration on small moduli.

Create a lesson

Metadata

Categories
math.NT, math.CO
Comments
19 pages, 2 tables. Code, data, proof notes and ECPP certificates of the test inputs: https://github.com/AlperTheKing/fast-primality (tag paper-v1)