factor, from GNU coreutils or BSD Games

preview_player
Показать описание
factor prints factors of numbers. I found there are two packages provide nearly the same, one from GNU coreutils [1] and another source is BSD Games. I didn't check the source code, so I am not sure if they are related as in sharing code, since the output looks quite similar.

Probably just be mimic output, the authors are different, so are the licenses and manpages. Anyway, it's really fast to calculate factors, factoring the eighth and ninth Mersenne primes:

$ time /usr/games/bin/factor 4951760154835678088235319297
4951760154835678088235319297: 2147483647 2305843009213693951

real 0m0.006s
user 0m0.003s
sys 0m0.002s

If I had known these, I probably would use them to solve Project Euler problems as shell scripting, I think since coreutils has `factor`, it's legit to me to solve the problems using `factor`, not a cheat.

$$#

/usr/bin/factor:

* Version 8.21 via Gentoo sys-apps/coreutils-8.21
* In C
* By Paul Rubin, Torbjörn Granlund, and Niels Möller
* GPLv3

/usr/games/bin/factor:

* 2004-02-08, from bsd-games 2.17 (2005-02-18) via Gentoo games-misc/bsd-games 2.17-r5
* In C
* By Landon Curt Noll
* New BSD License (3-clause)

Рекомендации по теме
welcome to shbcf.ru