{
    "mode": "info",
    "parameter": "factor",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/factor/json",
    "generated": "2026-07-30T12:24:27Z",
    "sections": {
        "File: coreutils.info,  Node: factor invocation,  Next: numfmt invocation,  Up: Numeric operations": {
            "content": "",
            "subsections": [
                {
                    "name": "26.1 'factor': Print prime factors",
                    "content": "'factor' prints prime factors.  Synopses:\n\nfactor [NUMBER]...\nfactor OPTION\n\nIf no NUMBER is specified on the command line, 'factor' reads numbers\nfrom standard input, delimited by newlines, tabs, or spaces.\n\nThe 'factor' command supports only a small number of options:\n\n'--help'\nPrint a short help on standard output, then exit without further\nprocessing.\n\n'--version'\nPrint the program version on standard output, then exit without\nfurther processing.\n\nFactoring the product of the eighth and ninth Mersenne primes takes\nabout 30 milliseconds of CPU time on a 2.2 GHz Athlon.\n\nM8=$(echo 2^31-1|bc)\nM9=$(echo 2^61-1|bc)\nn=$(echo \"$M8 * $M9\" | bc)\n/usr/bin/time -f %U factor $n\n4951760154835678088235319297: 2147483647 2305843009213693951\n0.03\n\nSimilarly, factoring the eighth Fermat number 2^{256}+1 takes about\n20 seconds on the same machine.\n\nFactoring large numbers is, in general, hard.  The Pollard-Brent rho\nalgorithm used by 'factor' is particularly effective for numbers with\nrelatively small factors.  If you wish to factor large numbers which do\nnot have small factors (for example, numbers which are the product of\ntwo large primes), other methods are far better.\n\nIf 'factor' is built without using GNU MP, only single-precision\narithmetic is available, and so large numbers (typically 2^{128} and\nabove) will not be supported.  The single-precision code uses an\nalgorithm which is designed for factoring smaller numbers.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}