Resultant of this polynomial with
x^n-1
using a probabilistic algorithm.
Unlike EESS, this implementation does not compute all resultants modulo primes such that their product exceeds the maximum possible resultant, but rather stops when
NUM_EQUAL_RESULTANTS
consecutive modular resultants are equal.
This means the return value may be incorrect. Experiments show this happens in about 1 out of 100 cases when
N=439
and
NUM_EQUAL_RESULTANTS=2
, so the likelyhood of leaving the loop too early is
(1/100)^(NUM_EQUAL_RESULTANTS-1)
.
Because of the above, callers must verify the output and try a different polynomial if necessary.
@return
(rho, res)
satisfying
res = rho*this + t*(x^n-1)
for some integer
t
.