1

I wanna factorize large integers using Pollard's $p-1$ method. My code is based on this:

Factoring large integers with the Pollard p-1 method

And looks as follows:

n = 1939900392481175101101462893543460784447034253991263908962636876409557208043058682516864365942068336973845078922522981168365133732048049885237907479175066840706500787738827165254575315273186376834299853517761277713938051355016186322030603563728949971286889223191828141474758368917643301805545585847158202870859030856164655492881248821859014256467557880626766501568641461532357356067956229763970686764008230518833896971726760554427;
b = 65537;
y = 0;
z = 0;
p = 0;

Monitor[ For[k = 0, k <= 150000, k++, y = PowerMod[b, k!, n]; z = y - 1; p = GCD[z, n]; If[p > 1, Return[p]]; ], k ]

Obviously, this does not work so I wonder if anyone has an idea on how to factorize large integers using Pollard's $p-1$ method in mathematica?

I also have the ciphertext:

c=829104585720293278626470138282411210590533811158703130580756826705756640524672985376810471616350668463680489398108960669984158688828010844108708408493717783601465735765204176314915216787694438820518397209550097224443643191484791651143362192151658048948204027173310314513331591611598291620931752367747278198047722865730004108846746722796203320711033035573007658737469411857835505566554339107332759317185845826056144437100913389492

thorimur
  • 9,010
  • 18
  • 32
Birka1177
  • 11
  • 1
  • The book at https://www.amazon.com/Course-Computational-Textbooks-Mathematical-Sciences-ebook/dp/B000RGUPQ6/ref=sr_1_18?dchild=1&keywords=Book+Computational+Number+Theory&qid=1615327428&sr=8-18 says Pollard's p-1 method is not very effective, and Pollard-Rho is much better. However, I tried implementations of the integer-factoring algorithms in that book, and FactorInteger in Mathematica works better than any of those algorithms. – Ted Ersek Mar 09 '21 at 23:48
  • 1
    Is there some reason to believe that number will be factored by the p-1 method? I have good reason to believe it will not. – Daniel Lichtblau Mar 10 '21 at 01:03
  • @DanielLichtblau I know nothing about any of these factoring methods, why do you think that number won't work? – b3m2a1 Mar 12 '21 at 00:06
  • @b3m2a1 Pollard p-1 requires that all but one factor of p or p-1 (I forgot which) be small. Also, it is a method used in FactorInteger. So either our cutoff is a bit too low,or it's unlikely to be amenable to that method. – Daniel Lichtblau Mar 12 '21 at 03:22
  • @DanielLichtblau ah the classic proof by we-tried-it-and-it-didn’t-work – b3m2a1 Mar 12 '21 at 04:09

0 Answers0