I am trying to use the Pollard $p-1$ method to find the factors of a large integer. Here is the problem:
An RSA-type cipher is based on the integer $n = 140016480344628383$ and exponent $2345671$. Factor n into a product of two primes, $p$ and $q$, using the Pollard $p-1$ method with base 2.
Once you have found $p$ and $q$, find the decryption index $d$ satisfying $de \equiv1\, ({\rm mod}\,(p-1)(q-1))$
None of my code is working. I can't seem to get it setup without having an overflow. Any tips and pointers would be so appreciated!
Here was one of my code attempts:
n = 140016480344628383;
b = 2;
y = 0;
z = 0;
ls = {};
p = 0;
For[k = 0, k <= 1500, k++,
y = Mod[b^k!, n];
b^k != Mod[y*(y - 1), n];
z = y - 1;
p = GCD[z, n];
If[GCD[z, n] > 1, ls = Append[ls, p]];
];
Out[113]= 373607131`
– Daniel Lichtblau May 08 '15 at 03:08