coreutils: factor invocation
1
1 26.1 ‘factor’: Print prime factors
1 ==================================
1
1 ‘factor’ prints prime factors. Synopses:
1
1 factor [NUMBER]...
1 factor OPTION
1
1 If no NUMBER is specified on the command line, ‘factor’ reads numbers
1 from standard input, delimited by newlines, tabs, or spaces.
1
1 The ‘factor’ command supports only a small number of options:
1
1 ‘--help’
1 Print a short help on standard output, then exit without further
1 processing.
1
1 ‘--version’
1 Print the program version on standard output, then exit without
1 further processing.
1
1 Factoring the product of the eighth and ninth Mersenne primes takes
1 about 30 milliseconds of CPU time on a 2.2 GHz Athlon.
1
1 M8=$(echo 2^31-1|bc)
1 M9=$(echo 2^61-1|bc)
1 n=$(echo "$M8 * $M9" | bc)
1 /usr/bin/time -f %U factor $n
1 4951760154835678088235319297: 2147483647 2305843009213693951
1 0.03
1
1 Similarly, factoring the eighth Fermat number 2^{256}+1 takes about
1 20 seconds on the same machine.
1
1 Factoring large numbers is, in general, hard. The Pollard-Brent rho
1 algorithm used by ‘factor’ is particularly effective for numbers with
1 relatively small factors. If you wish to factor large numbers which do
1 not have small factors (for example, numbers which are the product of
1 two large primes), other methods are far better.
1
1 If ‘factor’ is built without using GNU MP, only single-precision
1 arithmetic is available, and so large numbers (typically 2^{128} and
1 above) will not be supported. The single-precision code uses an
1 algorithm which is designed for factoring smaller numbers.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1