Fix typo in extended test for mersenne primes
Small speedup for p-1 factor