用 factor 做质因数分解
用一个小巧的 coreutils 命令把整数分解为质因数。
运行 factor 3600,会输出 3600 及其质因数。
01命令
命令
$ factor 360002作用说明
factor 接受一个或多个整数(或标准输入流),逐个输出质因数分解。它使用 Pollard rho 算法,对中等大小的数非常快,适合快速数学检查和脚本使用。
03风险
!注意: 超大整数可能很慢甚至无法分解,程序本身没有超时保护。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- GNU coreutils: factor依据: Documents factor, which prints the prime factors of each integer argument.
- Debian package: coreutils依据: Debian packages the GNU coreutils suite, which provides this command.
最后验证: 2026-09-20 · 分类: 开发者