[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
factor
: Print prime factors
factor
prints prime factors. Synopses:
factor [number]... factor option |
If no number is specified on the command line, factor
reads
numbers from standard input, delimited by newlines, tabs, or spaces.
The only options are `--help' and `--version'. See section 2. Common options.
The algorithm it uses is not very sophisticated, so for some inputs
factor
runs for a long time. The hardest numbers to factor are
the products of large primes. Factoring the product of the two largest 32-bit
prime numbers takes over 10 minutes of CPU time on a 400MHz Pentium II.
$ p=`echo '4294967279 * 4294967291'|bc` $ factor $p 18446743979220271189: 4294967279 4294967291 |
In contrast, factor
factors the largest 64-bit number in just
over a tenth of a second:
$ factor `echo '2^64-1'|bc` 18446744073709551615: 3 5 17 257 641 65537 6700417 |