Gerbicz error checking is a technique to verify validity of primality tests. It was proposed by Robert Gerbicz at MersenneForum in August 2017.
Among GIMPS clients, the technique is used to ensure validity of PRP tests for Mersenne numbers:
It is also used by LLR and LLR2 to ensure validity of Proth tests and PRP tests on base-2 Riesel prime candidates, and by those programs and PRST in an extended version for PRP tests on additional number forms.
Theory
The following describes the original formulation of the Gerbicz error check for Proth tests, as described in this MersenneForum thread:
Let be a Proth number, and let , , and be defined as on Proth's theorem, with a quadratic non-residue modulo . Let be a constant (originally defined as 2000, but described as possibly depending on ). We have the following equations:
Then is prime if and only if . We store only the last term of the sequence to use identity (3), and store , as well as the most recent and , where .
Every terms of the sequence we check the identity of (4). If this does not hold, then we roll back. If we roll back too much (e.g. 100 times to the same term), then we just restart the computation completely.
At the last few squarings in , we also force an error checking computation of (4) (in that when and , this means only one extra checking of (4).) This leaves all potential errors in the (at most) last squarings in , or very unlikely errors earlier in or .
The overhead is mulmods in (3) and squaremod in (4) and mulmods in (4), so over the mulmods of the Proth test, there are approximately mulmods, if we count everything in mulmods. Therefore, the overhead is 0.1% in time.
We could check all terms of , but in that case the overhead in the error checking would be mulmods, and that is a lot, slightly more time what we spend on the Proth test squarings.
See also
External links