国际访客建议访问 Primers 编程伙伴 国际版站点 > Bash 教程 > factor 以获得更好的体验。

# Bash 的 factor 命令

factor [OPTION] [NUMBER]...

!subtitle:功能

质因数分解。

!subtitle:类型

可执行文件(/usr/bin/factor),属于 coreutils

!subtitle:参数

  • OPTION 选项:

    • -h, --exponents - 以 x^n 的形式打印重复的因子

    • --help - 显示帮助

    • --version - 显示版本

  • NUMBER 要分解的整数列表

# 示例

$ factor 1995 2000 2005 2010 2015 2020 2025
1995: 3 5 7 19
2000: 2 2 2 2 5 5 5
2005: 5 401
2010: 2 3 5 67
2015: 5 13 31
2020: 2 2 5 101
2025: 3 3 3 3 5 5
$ factor -h 1995 2000 2005 2010 2015 2020 2025
1995: 3 5 7 19
2000: 2^4 5^3
2005: 5 401
2010: 2 3 5 67
2015: 5 13 31
2020: 2^2 5 101
2025: 3^4 5^2

# 推荐阅读

# 手册

FACTOR(1)                        User Commands                       FACTOR(1)

NAME
       factor - factor numbers

SYNOPSIS
       factor [OPTION] [NUMBER]...

DESCRIPTION
       Print  the prime factors of each specified integer NUMBER.  If none are
       specified on the command line, read them from standard input.

       -h, --exponents
              print repeated factors in form p^e unless e is 1

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by Paul Rubin, Torbjorn Granlund, and Niels Moller.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report any translation bugs to <https://translationproject.org/team/>

COPYRIGHT
       Copyright © 2023 Free Software Foundation, Inc.   License  GPLv3+:  GNU
       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
       This  is  free  software:  you  are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       Full documentation <https://www.gnu.org/software/coreutils/factor>
       or available locally via: info '(coreutils) factor invocation'

GNU coreutils 9.4                 April 2024                         FACTOR(1)
本文 更新于: 2025-11-27 09:38:14 创建于: 2025-11-27 09:38:14