Pollard’s p-1 factorization algorithm was invented by John Pollard in 1974. This factoring algorithm is based on Fermat Little Theorem. This algorithm is promising for factoring the composite number with a prime divisor such that has small prime factors. As a result, for any cryptosystem whose security is based on the hardness of the problem of factoring (e.g., RSA), it is critical that has at least one large prime factor.
The Ideas of Pollard’s p-1 Method
Let is a prime. According to Fermat Little Theorem, modulo whenever is an integer relatively prime to . Furthermore, if modulo , then divides . These two facts form the basis for Pollard’s p-1 method.
Let where and are two distinct prime numbers. First, we describe the overall strategy of Pollard’s p-1 factorization algorithm. The goal is to find a number such that divides but does not divide . Suppose such a number is found. Then for some random number , we have since Fermat Little Theorem tells us that . On the other hand, . Otherwise, we would have divides . The fact implies that .
With , we know that the prime divides . We also know that divides . Furthermore, we know that does not divide . Thus is the greatest common divisor of and , denoted by . Assuming that we can find , taking the GCD of and would yield the prime factor of .
The idea sounds wonderful. How do we find such a number . Note that The number captures in that divides or for some number . We can find iteratively. Choose a random number with . Start with for a relatively small . Compute . Compute the GCD of the numbers and , denoted by . If , then the GCD is a prime factor of . If the GCD is 1, then we compute and then compute and so on. One possibility o speeding up the calculation is that instead of incrementing the factorial by 1, we can increase it by a pre-determined value . That is, instead of using , we can use in the next step.
Some comments about the calculation. We do not have to derive the exact values of except for the first one. To start, we can compute the exact value of to compute . If we need to evaluate , we simply perform the exponentiation . Furthermore, the exponentiation does not have to be the exact value. It can be evaluated modulo . We can choose a random number to work as the base. In practice, we can use 2. Examples are given in the next section to illustrate the algorithm.
Examples
Example 1
Use Pollard’s p-1 method to factor the integer = 1,048,561. This is a semiprime, meaning that it is a product of two prime factors.
We use to start. We have = 3,628,800 and . Then we continue the calculation with larger factorials. We have the following results.
- ……………
- ……………
- …………..
- ……………..
Thus, 911 is one of the prime factors of = 1,048,561. Then the prime factorization is = 911 x 1151. To see why we only need to go up to in the calculation, with = 911 and = 1151, we have = 2 x 5 x 7 x 13 and = 2 x 25 x 23. The largest prime factor of is 13 and the largest prime factor of is 23. Furthermore, divides and does not divide . Thus, is the desired described above.
Example 2
Use Pollard’s p-1 algorithm to factor the number = 120,035,047,163, which is a product of two prime numbers.
We use the starting point = 39,916,800. With the GCDs being 1 for quite a few higher factorials, we only show the calculation leading to the last step.
- ……………
- ……………
- ……………..
- ……………..
- ……………..
- ……………
- ……………..
- ……………..
- ……………….
- ……………..
-
…………..
…………..
…………..
Thus, the factorization of is 1,299,601 x 92,363. With = 1,299,601 and = 92,363, let’s look at the factors of and .
Now we know that is made up of small primes with the largest being 19 while has a large prime factor (relatively speaking). Note that does not divide since 19 has exponent 2 in the factorization of . This lengthens the calculation to . Thus, with , we know that divides and that does not divide . As a result, Pollard’s p-1 calculation ends at .
Example 3
Factor the number = 30,069,476,293, which is a product of two prime factors.
The preceding two examples show that the Pollard p-1 calculation usually needs to go up to the factorial corresponding to the largest prime factor of (or ). In this example, we show that the choice of the base also matters, though it is not a choice we can make at the outset. We use to start and make the following calculation.
- ……………..
- ……………
- ……………
- ……………
- ……………
With the above calculation, we have = 104,729 x 287,117. With = 104,729 and = 287,117, we examine the factorizations of and .
With the largest prime factor of being 53, why do we not have to calculate all the way to ? The answer is that the base 2 in this example is a good choice for a base. The order of 2 modulo is 1976, much smaller than = 104,729. In this case, the base 2 is not a primitive root modulo . If we use a base that is a primitive root modulo , then the calculation would extend all the way to . Since we do not know the value of before the calculation, choosing a good base is not something we can do. Thus, there is an element of luck in the Pollard p-1 method.
We now analyze this situation further by showing how the number 1976 is determined. To determine whether the number 2 is a primitive root modulo = 104,729, we need to evaluate the exponentiation modulo for all prime factors of .
- .…………..
- .…………….
- .…………….
- .…………….
If the number 2 were to be a primitive root, the results on the right side of the above calculation should be all not congruent to 1. In this case, the smallest exponent of 2 is 1976, which is the order of 2 modulo . In the above explanation of Pollard’s p-1 method, we say that we need to find such that divides but does not divide . Note that is this case is 104,828. In this example, we do not need to go this high, we just need to find such that 1976 divides . Our calculation shows that can be . Again, this is an element of luck. This analysis can only be performed after the fact.
For comparison, let’s use a primitive root as the base. The number 12 is a primitive root modulo . We start with and find that the GCD is 1. Based on the analysis in the preceding paragraph, we know the calculation likely needs to go up to . So we skip from to .
- ……………
- ……………
- ……………
-
…………..
…………..
…………..
The last calculation shows that if we happen to use a primitive root (modulo one prime factor of ) as the base, the calculation may take longer. Ideally, we would like to use a base that has small order. Of course, this is not a choice we can make ahead of time.
Example 4
In this example, we use Pollard’s p-1 method to factor = 21,428,053, which is a product of two prime numbers.
We start with and compute modulo . The GCD values of are all 1’s even after a long series of calculation. Thus, we only show that selected steps to give a sense of the amount of effort.
- …………….
- ……………..
- ……………
- ………………..
- ……………
- ……………..
- ……………
- ……………
- ……………
-
…………..
…………..
…………..
-
…………..
-
…………..
-
…………..
-
…………..
The calculation shows that = 4073 x 5261. Now that we have the answer, we can analyze the process. Here’s the factorization of and where = 5261 and = 4073.
The largest prime factor of is 263. The largest prime factor of is 509. This indicates that the calculation would involve . The base 2 is a primitive root modulo 5261, ensuring that the calculation would need to go to . Note that the composite in this example is much smaller than the ones in Example 2 and Example 3. Yet this example requires a lot more effort because (or ) has larger prime factors. This example reinforces the point that Pollard’s p-1 algorithm excels in factoring where is one of the prime factors of and has small prime factors. The smaller the prime factors of , the lower the amount of calculation.
Fermat Numbers
The composite numbers in the four examples in the preceding section are only illustrations for Pollard’s p-1 factorization algorithm. The numbers in these examples are small enough so that the trial division, when programmed in a computer, is workable as a factorization algorithm. In this section, we mention two examples of factorization that are in much larger scale than the above examples. Both examples involves the 12th Fermat number.
A Fermat number is a positive integer of the form where is a non-negative integer. Due to their large sizes, Fermat numbers are difficult to factor or to check for primality. Pepin’s test is a primality test for Fermat numbers (see here). According to the Wikipedia entry on Fermat numbers (see here), only the Fermat numbers to have been completely factored as of November 2021. Currently, six factors of have been discovered so far (see here).
Edouard Lucas in 1878 proved that every factor of the Fermat number , , is of the form . A number of this form is called a Proth number. One prime factor of was discovered by R. Baillie in July 25, 1986, which is a 16-digit number. The following is the 16-digit prime factor along with the factorization of .
Note that the largest prime factor of is 29,521,841, which is small enough relatively speaking. As a result, Pollard’s p-1 method was used in this case.
A 54-digit prime factor of was discovered by M. Vang, Zimmermann & Kruppa in March 27, 2010. It is expressed as where is a 50-digit prime number. Thus, the largest prime factor of is the 50-digit prime number . This prime factor was discovered using the Elliptic Curve Method (ECM) and could bot have been discovered using Pollard’s p-1 method. This example reinforces the idea that for Pollard’s p-1 method to work, needs to be made up of “small” prime factors for one prime factor .
Remarks
One point worth mentioning is that when we obtain a new factor using Pollard’s p-1 method, we need to check its primality, e.g., using a primality test such as the Miller-Rabin test. The numbers in the four examples given above are stated as a product of two primes. As a result, any factor that results can be assumed a prime. When the factoring effort has no known facts given, we cannot just assume any factor produced is a prime number.
The four examples above are structured in a way that each is a product of two primes (i.e., they are semiprimes). Pollard’s p-1 method can certainly be used for factoring numbers that have more than two prime factors. Just that each resulting factor should be further factored if it turns out to be not a prime.
Pollard’s p-1 algorithm has elements of luck involved. For example, if we happen to use a starting point for that is not far from the factorial that produces a prime factor, the algorithm works spectacularly well. On the other hand, if we happen to use a base that has a lower order modulo one of the prime factors, the calculation may stop as a lower value of . Of course, the amount of calculation depends on the magnitude of the prime factors of . If the largest prime factor of is a 50-digit number as for one prime factor of the Fermat number as indicated in the preceding section, Pollard’s p-1 method should not be considered. On the other hand, another factor of the Fermat number was obtainable using Pollard’s p-1 because the largest prime factor of is only an 8-digit number. When doing exercise problems on factoring using Pollard’s p-1 method, the amount of effort varies. The that produces a factor may be in the range of 10s or 100s or even 1000s for . The decision of how high of a factorial we are willing to go is based on how much effort we wish to expend or whether the computational resources at our disposal are up to the challenge.
The study of factoring adds to our understanding of cryptosystems whose security relies on the apparent difficulty of factoring large numbers. For example, with insight obtained from knowing Pollard’s p-1 method, when setting the modulus for RSA, we can improve the security by choosing and such that and have at least one large prime factor. When the primes and are large, the resulting RSA public key may seem secure. If and have small prime factors, it is a vulnerability Pollard’s p-1 factoring method can exploit.
Dan Ma Pollard’s p-1 factoring algorithm
Dan Ma Pollard’s p-1 factoring method
Daniel Ma Pollard’s p-1 factoring algorithm
Daniel Ma Pollard’s p-1 factoring method
2023 – Dan Ma