question on possible factor() function for gmp

Jane Sullivan janesullivan at
Fri Jul 6 19:16:03 UTC 2018

On 06/07/2018 17:40, Dennis Clarke wrote:
> 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.

You could try YAFU (Yet Another Factoring Utility). It can be downloaded from:

More instructions are available at
post #8 in particular.

There is also a subforum for YAFU:

Best wishes
Jane Sullivan

More information about the gmp-discuss mailing list