Given a number x, I would like to find all non-repeating combinations of integers in range 1:n that form a vector of length m whose elements sum to x.
For example: x = 9; n = 6; m = 3;
Should return: [4 3 2] [5 3 1] [6 2 1]
This will be used many times with an n ~ 100, and needs to be general for any x or m, so the method should be as efficient as possible.
Best Answer