0

I'm looking to find all the combinations of numbers possible in the below example. I shall do my very best to explain the situation clearly as I'm not too sure how to derive this outcome myself. Thanks in advance.

I'm looking to have this in spreadsheet format since it will be a long list (from research it seems possible for their to be a function in a spreadsheet that can do this. If I only knew how I would do it myself!

There are 3 people. The sum of numbers between these 3 people can only equal 45 in total no more.

An example of an outcome would be something like this:

30,5,10

5,10,30

10,30,5

10,5,30

30,10,5

5,30,10

I want to extend this simplified example to show all the outcomes possible. Only conditions are that the numbers combined can't exceed 45. 0 is not considered.

Kind regards,

Harvey :)

*Also if anyone can explain how to do this in a spreadsheet I will be very grateful.

  • 2
    Must it only not exceed 45, or need it equal 45? – Jonathan Y. Nov 06 '13 at 19:04
  • If you are talking about choosing ordered three-tuples whose sum is less than or equal to 45, then you are looking at around $\sum_{i=1}^{45}\binom{i+2}{3} \approx 200000$ possibilities. Is that really what you want? – nispio Nov 06 '13 at 19:10
  • All your examples are multiples of $5$. If that is a requirement, you can divide by $5$ and ask that the numbers sum to $9$. That will have many fewer possibilities. – Ross Millikan Nov 06 '13 at 19:13
  • I don't know for sure, but I suspect that the answer is no; at least not without a fair amount of programming. You also need to give a slightly more rigorous definition of your requirements as they remain somewhat ambiguous. I would take out the reference to "people" altogether because it only confuses the question. Also, can an element be 0 as long as the sum is not zero, or must each element of the three-tuple be between 1 and 43? – nispio Nov 06 '13 at 19:25
  • Please do not delete questions which people have already aswered. – Mariano Suárez-Álvarez Nov 07 '13 at 02:03
  • Wow, not so much as a "thanks anyway?" – nispio Nov 07 '13 at 20:02

3 Answers3

1

What you are looking for would be something along the lines of $ 0 < x_0 \leq 43, 0 < x_1 \leq 44-x_0, 0 < x_2 \leq 45-(x_0 + x_1)$ where $x_0, x_1, x_1 \in \Bbb N$.

shade4159
  • 757
0

The following is a Matlab program that will generate the output you are after:

fid = fopen('tuples.csv','w');
for s = 3:45
    for i = 1:(s-2)
        for j = 1:(s-1-i)
            k = s-i-j;
            fprintf(fid,'%d, %d, %d\n', k, j, i);
        end
    end
end
fclose(fid);

This creates a CSV file that can be opened in Excel. I think that you would be hard pressed to find a solution in Excel that doesn't involve writing some VBA code. If you don't have access to Matlab, you could also run the code in Octave which is free. You could also easily port the above code to the language of your choice.

nispio
  • 462
  • If all else fails, I have uploaded the resulting CSV file here: http://rapidshare.com/share/4A63FB0EF831DAC6F929E22117FFD7AC – nispio Nov 06 '13 at 20:33
-1

There would be $n-1 \choose k-1$ combinations for writing non-zero positive integral solutions of $x_1+x_2+.......x_k = n$