Get all possible combinations to get a given sum with no repeating numbers
<p>I am trying to solve a problem with numbers:</p>

<p>I receive a number and have to calculate the numbers that add up to get that number, there are some rules that make it harder</p>

<p>Rules:</p>

<ul>
<li>Positive numbers only, cannot include 0 in the sum</li>
<li>The sum must be composed of only 6 numbers, no more no less</li>
<li>The numbers to add can go from 1 to 45</li>
<li>Cannot repeat numbers</li>
<li>The maximum sum is 255</li>
<li>The minimum sum is 21</li>
<li>A valid combination is 1, 2, 3, 4, 5, 6 just as 6, 5, 4, 3, 2, 1 or 3, 4, 5, 1, 6, 2 but only counts as one combination because contain the same numbers but in different order</li>
</ul>

<p>I have been trying to do it like in the knapsack problem but the difference is that I must choose a fixed amount of numbers to get the sum.</p>

<p>If anyone has an idea of an algorithm to fix this, I would really appreciate it.</p>