I'm trying to use a
factor utility but it tells me that number is too large. Is there any utility that can do what
factor doing but not tells that number is too large?
I'm trying to use a
factor is not built with
GMP, so it can not handle number bigger than
$ factor 18446744073709551616 factor: `18446744073709551616' is too large $ factor 18446744073709551615 18446744073709551615: 3 5 17 257 641 65537 6700417
Running this command to check if
factor built with
$ ldd /usr/bin/factor linux-vdso.so.1 (0x00007fffda1fe000) libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007faae00f5000) libc.so.6 => /lib64/libc.so.6 (0x00007faadfd46000) /lib64/ld-linux-x86-64.so.2 (0x00007faae037c000)
The limit may be higher on some machines (the number has to fit in
uintmax_t type), but your number is a 256-bit number, and no common machine supports such a big
uintmax_t, if any.
Note that the
factor utility can be compiled with GMP support. In that case, there is effectively no limit on the size of the number. It appears that your distribution hasn't activated GMP support (which makes sense since it would add a dependency on an extra library to a core system package for a rarely used feature).
If you have
perl, you can try
factor.pl program include in
$ /home/cuonglm/.cpan/build/Math-Prime-Util-0.31-9c_xq3/bin/factor.pl 115792089237316195423570985008687907852837564279074904382605163141518161494337 115792089237316195423570985008687907852837564279074904382605163141518161494337: 115792089237316195423570985008687907852837564279074904382605163141518161494337
You can also use
factor from the coreutils. However it needs to be compiled with bignum support. FYI, this is not the case with the binary that comes with some distributions, such as Debian (bug 608832). But you can download the source and recompile it after installing GMP (which is used by default if found).
Another solution is to use Pari/GP (well-known for number theory):
? factor(806578020551755900412008880903137528217525975284037923) %1 = [ 238366085426200783161668947 1] [3383778439410064898661524209 1]
With this number, it takes a few seconds.