Sunday, October 07, 2012

[ciglyozo] MPQS upper limit for Pari/GP

Pari/GP 2.3.4 has hardcoded not to attempt Multi-Polynomial Quadratic Sieve to factor composites greater than 10^107 (MPQS_MAX_DIGIT_SIZE_KN). A hardcoded threshold is probably not a good idea as computers get exponentially faster with exponentially more memory (although 10^107 today still takes a very long time).  However, the limit suggests a puzzle: what is the largest RSA-like number its MPQS can be made to factor?

Maximize p*q subject to p prime, q prime, 0.5 < p/q < 2, p*q < 10^107.

After some search, best so far is p = 237310090700519800619661552790941036919590804668812753 ; q = 421389582317415385969478644565860330341101306461997357 ; 10^107-p*q = 1.9 * 10^46 = 0.000000059 * sqrt(10^107)

\p120
ee=107;m=floor(sqrt(10^ee));lo=floor(sqrt(10^ee/2));ss()=x=nextprime(lo+random(m-lo));y=precprime(10^ee/x);[x,y]
pmax=0;for(i=1,10^20,xy=ss();if(xy[1]*xy[2]>=pmax,pp=xy;pmax=xy[1]*xy[2];print(floor(1000*log(10^107-pmax))," ",i," ",pp[1])))

If 107 were an even number, we could simply search for (a+n)*(a-n) in the style of 10^90-81

No comments :