Homepage Solution manuals Ivan Niven An Introduction to the Theory of Numbers Exercise 2.4.18* (Difficulties with Pollard $p-1$ method)

Exercise 2.4.18* (Difficulties with Pollard $p-1$ method)

Apply the Pollard p 1 method to the number 1891 . Explain what difficulties are encountered and how they might be overcome.

Answers

Proof.

a)
I we use the same instructions than in Problem 17 for m = 1891 , we obtain
     In [1]: from math import gcd
     
     In [2]: m = 1891
     
     In [3]: r = 2
        ...: for n in range(2,8):
        ...:     r = pow(r,n,m)
        ...:     print(n, ’=>’, gcd(r-1,m))
        ...:
     2 => 1
     3 => 1
     4 => 1
     5 => 1891
     6 => 1891
     7 => 1891

This gives not a proper divisor of m = 1891 , because the two factors p = 31 and q = 61 of 1891 = 31 × 61 are such that

p 1 4 ! , p 1 5 ! , q 1 4 ! , q 1 5 ! .

Therefore 31 × 61 d 5 = ( 2 5 ! 1 ) m , but 31 d 4 , 61 d 4 .

b)
These difficulties might be overcome if we change the initial value of r (or if we use another algorithm!). For r = 5 , d n = ( 5 n ! 1 ) m .
     In [4]: r = 5
     
     In [5]: for n in range(2,8):
        ...:     r = pow(r,n,m)
        ...:     print(n, ’=>’, gcd(r-1,m))
        ...:
     2 => 1
     3 => 31
     4 => 31
     5 => 1891
     6 => 1891
     7 => 1891

We obtain the non trivial factor d 3 = 31 , because 31 5 3 ! 1 = 15624 = 2 3 3 2 7 31 .

c)
We give a more convenient program, with an optional parameter r :
     In [1]: from math import gcd
     
     In [2]: def pollard(m, r=2):
        ...:     n = 2
        ...:     while gcd(r - 1, m) == 1:
        ...:         r = pow(r, n, m)
        ...:         n += 1
        ...:     return gcd(r - 1, m)
        ...:
     
     In [3]: pollard(199934971)
     Out[3]: 16193
     
     In [4]: pollard(1891)
     Out[4]: 1891
     
     In [5]: pollard(1891, 5)
     Out[5]: 31
     
     In [6]: pollard(7081)
     Out[6]: 7081
     
     In [7]: pollard(7081, 5)
     Out[7]: 73
     
     In [8]: pollard(7081, 6)
     Out[8]: 97
     
     In [9]: 73 * 97
     Out[9]: 7081
     
     In [10]: F6 = 2 ** (2 ** 6) + 1
     
     In [11]: pollard(F6, 3)
     Out[11]: 274177

So

F 6 = 2 2 6 + 1 = 18446744073709551617 = 274177 × 67280421310721 .

User profile picture
2024-08-24 09:42
Comments