question on possible factor() function for gmp

Dennis Clarke dclarke at
Fri Jul 6 16:40:39 UTC 2018

On 07/06/2018 12:15 PM, Torbjörn Granlund wrote:
> logical american <website.reader3 at> writes:
>    Has someone put together a function for gmp called factor(n) where n
>    is integer? (output is a list of factors and their powers)
> Probably not.  (I assume you mean prime factors here, else I can provide
> a simple function returning 1 and n in a list...)

This feels like it is way out of scope for gmp. Probably best to look at
general number field sieve software and other esoterics which are needed
for any large numbers.  Otherwise the source from GNU factor most likely
gets the job done.


More information about the gmp-discuss mailing list