View Single Post 2020-10-01, 20:15   #4
jshort

"James Short"
Mar 2019

17 Posts Quote:
 Originally Posted by jshort Suppose we're factoring an integer via the p-1 method and we've already completed the first stage ie. where is the composite we wish to factor. In the 2nd stage, we assume that there is one prime factor remaining and go on to compute for various prime integers. If is fairly smooth, would it not be more worthwhile to consider the set for some considerably smaller integer and then compute for all ? Keep in mind that we can perform another kind of "2nd stage" on this as well. ie assume that captures most of the prime factors of and then use a 2nd stage (3rd stage?) by computing for various primes and again computing for all .
I know its bad form to write answers to your own question. To be honest I don't have a straightforward answer as to whether or not this way of conducting a 2nd-stage to the p-1 method is faster than the standard way.

However I also think that we can easily implement both.

25% of all prime integers have the form . This can be proved using Dirichlet's theorem on arithmetic progressions -

https://en.wikipedia.org/wiki/Dirich...c_progressions

Thus we could set the and compute for various primes up to some limit. Most programs search for primes in the 2nd stage of the p-1 test. If we did the same here and if we're only checking for primes of the form in the range than would only have to be a prime up in the range .

One thing I should mention is that obviously you'd want to start at 11 and then work your way up since just as in the standard 2nd stage of the test, you can use previous terms to save time in computing future terms.

For example, let .

Then and so on.

As for the other 75% of the primes in the range , we could either run this same alternative 2nd stage as we just did. However if this proves to be slower, we can just use the standard 2nd stage that is commonly used to check the remaining primes individually.  