#分数 #质因数 #分解 #质数

bin+lib factor-rs

用于列出数字或分数的质因数的命令行程序

2 个稳定版本

1.2.1 2023 年 4 月 24 日
1.2.0 2023 年 4 月 19 日

#9 in #质因数

每月下载 23

MIT 许可证

27KB
591

factor-rs

一个命令行程序,用于列出数字或分数的质因数。使用 prime_factorization 库。支持从 -2128 到 2128 的所有整数,所有分子和分母小于 2128 的分数(不分正负),以及所有尾数小于 2128 且指数小于 39 的十进制数(不分正负)。分数和十进制数也会化简到最简形式。

示例

$ factor 0 1 3 8 12 -255 4/12 6.125 -7/3 5/0 0/0
0 = 0
1 = 1
3 = 3
8 = 2^3
12 = 2^2 * 3
-255 = -1 * 3 * 5 * 17
4/12 = 3^-1 = 1/3
6.125 = 2^-3 * 7^2 = 49/8
-7/3 = -1 * 3^-1 * 7
5/0 = 5 * 1/0 = 1/0
0/0 = 0/0

许可证

Copyright (c) 2023 Esper Thomson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

依赖项

~1.4–2MB
~43K SLoC