question on possible factor() function for gmp

paul zimmermann Paul.Zimmermann at inria.fr
Thu Jul 5 21:25:57 UTC 2018


       Dear Randall,

> Date: Thu, 05 Jul 2018 10:39:53 -0700
> From: logical american <website.reader3 at gmail.com>
> 
> Has someone put together a function for gmp called factor(n) where n is 
> integer? (output is a list of factors and their powers)
> 
> I did play around with the Pollard method but when I was working with 
> 30-40 digit numbers to factor, GP Pari was always faster than gmp in 
> this region.
> 
> I understand that a general purpose program will shift algorithm 
> according to the size of the number, such as the general number field 
> sieve, when we're around 100 digits or so, but I would like to see some 
> speed in the region of 20-80 digits.
> 
> Thank you for responding.
> 
> - Randall

you might try GMP-ECM, whose library provides a function ecm_factor:

int ecm_factor (mpz_t maybe_factor, mpz_t input_n, double B1, ecm_params params);

It will only find one factor at a time (when successful) but it is easy
to write a wrapper around it.

Paul Zimmermann


More information about the gmp-discuss mailing list