How do I generate integer partitions?
algorithm, combinations
Solution
This is a slight modification of the change making problem. You should be able to find plenty of papers on this problem, and a dynamic programming solution would take no more than 20 lines of code.
http://en.wikipedia.org/wiki/Change-making_problem
Problem
I have a list of numbers like 1,2,3 and I want to find all the combination patterns that sum up to a particular number like 5. For example: ``` Sum=5 Numbers:1,2,3 Patterns: 1 1 1 1 1 1 1 1 2 1 1 3 1 2 2 2 3 ``` You're allowed to repeat numbers as far as they don't go over your sum. Which way would be best to program this?