Thursday, 15 August 2013

Combinations of ratios of 4 different numbers

Combinations of ratios of 4 different numbers

I have 4 different substances I have to mix in all possible combinations.
Let's say that the max quantity per substance is 5000, and that every step
is 1000. So a substance can appear in a combination as
0,1000,2000,3000,4000 or 5000.
I was planning do to a for loop, for the 4 substances, going from 0 to
5000 in all of them, but I am aware this will produce lots of duplicate
results. For example, (1000,1000,1000,1000) is the same as
(5000,5000,5000,5000)
How can I make all the combinations without repetition?

No comments:

Post a Comment