버전 (3.26 KB) 작성자: Matt Fig
Find all factorings of N which have K elements.
다운로드 수: 639
업데이트 날짜: 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.


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 (, 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!
버전 게시됨 릴리스 정보

Bug fix.