Partitions of an integer

버전 1.21.0.0 (5.61 KB) 작성자: John D'Errico
List all partitions of an integer
다운로드 수: 6.1K
업데이트 날짜: 2018/3/11

라이선스 보기

The money changing problem is a simple one to state. For example, how many different ways can one form change of a dollar (100 cents) by using only coins of denomination [1 5 10 25 50] ? (The answer is 292.)
Its an example of a general problem, i.e., in how many unique ways can an integer be partitioned as a sum of smaller positive integers?
http://en.wikipedia.org/wiki/Integer_partition
I wrote partitions to solve the fully general problem, but it can be used with restrictions too. You can constrain the set of elements in the sum, and the maximum number of times any one elements can appear, as well as fixing the total number of terms that will appear in the final sum.
See the demo for a few examples of use.

인용 양식

John D'Errico (2024). Partitions of an integer (https://www.mathworks.com/matlabcentral/fileexchange/12009-partitions-of-an-integer), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R14SP1
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
도움

받음: partitiontable.m

줌: nsumk

Community Treasure Hunt

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

Start Hunting!

partitions/html/

버전 게시됨 릴리스 정보
1.21.0.0

Comment change

1.2.0.0

Fix the plist=partitions(10,[1:5],[1],[4]) bug.

1.0.0.0

Added a new option: a user defined number of terms in the sum.