NFACTORK

版本 1.1.0.0 (3.3 KB) 作者: Matt Fig
Find all factorings of N which have K elements.
639.0 次下载
更新时间 2010/3/29

查看许可证

NFACTORK All integer factorings of integer N which have K elements.
T = NFACTORK(N,K) returns an array which has K columns such that all(prod(T,2)==N) is true.

Examples:

T = nfactork(24,3) % produces
T =
1 1 24
1 2 12
1 3 8
1 4 6
2 2 6
2 3 4

such that: all(prod(T,2)==24) % True


T = nfactork(N,inf);
% Last row is factor(N)
% unique(T) lists all divisors of N


This was written in response to a NewsGroup question.
Like many combinatorial problems, this one can grow very quickly and soon overwhelm the system resources. Suggestions for improvements are always welcome.
See the function help and comments in code for more information.

引用格式

Matt Fig (2024). NFACTORK (https://www.mathworks.com/matlabcentral/fileexchange/27086-nfactork), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Elementary Math 的更多信息
致谢

启发作品: factorpairs

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Bug fix.

1.0.0.0