where
is an exact power of two.
is an integer of roughly the same size.
The algorithm can be restarted if
and
are stored.
(So a few extra digits is easy.)
Complexity is O
,
but in practice it's good. (Still needs an FFT.)
Error checking by congruences.