Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If $N-1$ could be factored easily with several small prime factors, then what is the fastest way to check $N$ for primality?


I'm aware of Pocklington primility test which is not good for small factors. I'm looking for a reduction in modular exponentitation when $N-1$ has several small factors.

share|cite|improve this question
Are you familiar with the Pocklington test, ? – Gerry Myerson Dec 3 '12 at 9:59
It is not fast, since finally it requires modular exponentiation with $N-1$ in exponent, which requires the same time of Fermat Little Theorem PRP test. – Mohsen Afshin Dec 3 '12 at 10:15
The pocklington test relies on the fact that $N-1$ is divisible by some relatively large prime, which doesn't seem to be the case. – Arthur Dec 3 '12 at 11:05
@Arthur: See the section "Generalized Pocklington method" in the Pocklington Test Wikipedia article. This removes youe restriction. – TonyK Dec 3 '12 at 11:11
@Arthur: You should do these exponentiation in parallel, to save even more time. I don't mean using multiple processors, I mean exponentiating them all at once by incorporating the successive square only in those results that have the appropriate bit set. (If you are familiar with square-and-multiply exponentiation, this might make some sense!) – TonyK Dec 3 '12 at 11:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.