[Ecm-dev] Proposal from George. Literally.

George Woltman woltman at alum.mit.edu
Sam 7 Mai 18:13:11 CEST 2005

At 05:27 PM 5/6/2005, Alexander Kruppa wrote:
>Paul Zimmermann wrote:
>>Indeed! About the k*b^n+c form, can prime95 deal with b<>2?
>Not yet, but in an earlier mail George mentioned that he plans to look 
>into it.

Alex is right.  For b <> 2, I'd return the "cannot handle this k,b,n,c" 
error code
and GMP-ECM would proceed with its current code.  I thought it best to send b
to the routine in case of future enhancements.

>>Assuming 2), for which configurations will you provide prime95 libraries?
>>Windows, MacOS, Linux? x86, powerpc, x86_64?

I can build libraries for Windows 32-bit and Windows 64-bit.  Linux and
FreeBSD 32-bit only.

We'd have to benchmark prime95 stage 1 against GMP-ECM's stage 1 on an x86_64
machine.  I think prime95 will still win, but the advantage will be greatly 

>About the interface: GMP-ECM would like to be able to pass either the 
>sigma or A paramter for the curve. For resuming, we'd need to be able to 
>pass the x-coordinate of the point to start with (also needed if the curve 
>is specified by A). For the -go option, we'd have to be able to pass an 
>arbitrary precision integer that the initial point get multiplied by. And 
>for resuming, we'd need a B1done parameter, so that only primes and prime 
>powers B1done < p^k <= B1 are processed. And factors may
>So I'd like to propose this interface:
>int ecmStage1 (
>double k,
>unsigned long b,
>unsigned long n,
>long c,
>unsigned long B1,
>unsigned long B1done,
>int sigma_is_A,
>unsigned long *sigma_or_A,
>unsigned long *num_being_factored_array,
>unsigned long num_being_factored_array_len
>unsigned long *x_array,
>unsigned long *x_array_len
>unsigned lont *go_array,
>unsigned long go_array_len)
>Stage 1 should compute the A parameter from sigma if sigma_is_A == 0, 
>otherwise read A directly. If *x_array_len == 0 and sigma_is_A == 0, the 
>starting point x should be computed from sigma, if *x_array_len != 0 or 
>sigma_is_A != 0, the starting point should be read from *x_array. The 
>combination *x_array_len == 0, sigma_is_A != 0 is illegal.

The interface would be cleaner if you always passed A and starting x 
(already multiplied
by go_array).  However, if this information is not handy at the time you 
would be calling
this routine, then we can go with the more complicated interface 
above.  I'm a little
confused when sigma_is_A != 0 -- where do I read A from?  Is it the 32-bit 
value in

>For the return codes, I'd suggest
>0 = success, but no factor
>1 = factor found (during sigma->A conversion or normalization)
>2 = could not handle this k,b,n,c combination
>3 = out_of_memory


4 = stopping at user request.  B1done is returned.  X is returned for 
caller to write to a
save file.  How do I detect this user request?  Do you have a signal 
handler that
sets some global variable for me to check periodically?


No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

Plus d'informations sur la liste de diffusion Ecm-discuss