Subject: bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)

From: Pádraig Brady <[email-masked]>
Date: Fri, 07 Sep 2012 10:28:19 +0100

On 09/07/2012 09:43 AM, Niels Möller wrote:
> Jim Meyering<[email-masked]>  writes:
>
>> The existing code can factor arbitrarily large numbers quickly, as long
>> as they have no large prime factors.  We should retain that capability.
>
> My understanding is that most gnu/linux distributions build coreutils
> without linking to gmp. So lots of users don't get this capability.
>
> If this is an important feature, maybe one should consider bundling
> mini-gmp and use that as a fallback in case coreutils is configured
> without gmp (see
> http://gmplib.org:8000/gmp/file/7677276bdf92/mini-gmp/README). I would
> expect it to be a constant factor (maybe 10) times slower than the real
> gmp for numbers up to a few hundred bits (for larger numbers, it gets
> much slower due to lack of sophisticated algorithms, but we probably
> can't factor them in reasonable time anyway).

Bundling libraries is bad if one needed to update it.
The correct approach here is to file a bug against
your distro to enable gmp which is trivial matter
of adding the build and runtime dependency on gmp.

cheers,
Pádraig.