Hi, gmp-ecm version 5 can read ECM residues written by Prime95 to perform stage 2 on them. Stage 2 is asymptotically faster in gmp-ecm, but Prime95 has a much faster multiplication for large numbers, so this feature is mostly interesting for relatively small numbers (i.e. of a few thousand bits) that are to be factored with a large stage 2 limit. Another feature is that the B2 value in gmp-ecm is not limited to 2^32, so you may take stage 2 limit to much higher values than Prime95 currently supports.
In order to be able to resume ECM residues from Prime95 (version 22.9 or later), you will first have to set the GmpEcmHook option (described in undoc.txt) in prime.ini. Simply add the line GmpEcmHook=1 This will cause Prime95 to write the residues from the end of stage 1 to results.txt if no stage 2 is performed. These residues in results.txt can be read into gmp-ecm with the -resume option to do stage 2. Example: Richard Brent's factorization of F10 (remeber to put the smaller factors 45592577 and 6487031809 into lowp.txt if you want to try this example yourself) workdodo.ini : ECM=1024,314263,1,1,0,14152267,1,20 This computes the lucky curve with sigma=14152267 and a stage 1 bound of 314263. Note that B2 is set to 1, so that Prime95 will not do a stage 2 but will write the residue instead. Running Prime95 (or mprime) now outputs Mersenne number primality test program version 22.12 ECM on P1024: curve #1 with s=14152267, B1=314263, B2=314263 Stage 1 complete. 8133791 transforms, 1 modular inverses. Time: 13.603 sec. Stage 1 GCD complete. Time: 0.000 sec. There are no more exponents to test. Please send the results.txt file to [EMAIL PROTECTED] Contact the PrimeNet server for more exponents. The results.txt file contains [Wed Feb 26 19:15:13 2003] N=0x3E(... deleted ...)001; QX=0x275(...deleted...)802; SIGMA=14152267 UID: akruppa, P1024 completed 1 ECM curves, B1=314263, B2=314263 The stage 2 for this residue can be computed with gmp-ecm 5 by running ecm -resume results.txt 1 314263-10000000 which outputs GMP-ECM 5.0 [powered by GMP 4.1] [ECM] Save file line has no equal sign after: [Wed Feb 26 19: Resuming ECM residue saved with Prime95 Input number is 607(... deleted ...)569 (291 digits) Using B1=1, B2=314263-10000000, polynomial x^1, sigma=14152267 Step 1 took 0ms Step 2 took 2450ms ********** Factor found in step 2: 4659775785220018543264560743076778192897 Found probable prime factor of 40 digits: 4659775785220018543264560743076778192897 Probable prime cofactor 130(... deleted ...)577 has 252 digits Save file line has no equal sign after: UID: akruppa, P The factor is being found. (Gmp-ecm complains about the lines in results.txt it does not understand, but the residues should be processed correctly) The parameters to gmp-ecm are: -resume <filename> Which file to read the residues from 1 The stage 1 limit, which we set to 1 because we have already done the stage 1 computations with Prime95 314263-10000000 The stage 2 range. Prime95 did stage 1 with B1=314263, so we tell gmp-ecm to do stage 2 from that point on, up to 10000000. The lower limit of the stage 2 range should always be set to the B1 value Prime95 used, the upper limit is the effective B2 value for the ECM curve. If you would like to do, say, 100 curves on F12 with B1=44000000, you should have in worktodo.ini ECM=4096,44000000,1,100,0,0,1 After Prime95 has completed the stage 1 for the 100 curves, you can resume the residues in results.txt with ecm -resume results.txt 1 44000000-184367799127 Note: 184367799127 is the default value for gmp-ecm with B1=44M. You may want to lower it so that the time spent in Prime95 and gmp-ecm per curve is roughly the same. Note 2: remember to remove or rename results.txt after running it through gmp-ecm, or the next time around it will process the same residues again. Happy factoring, and good luck! Alex _________________________________________________________________________ Unsubscribe & list info -- http://www.ndatech.com/mersenne/signup.htm Mersenne Prime FAQ -- http://www.tasam.com/~lrwiman/FAQ-mers