6 Numbers All Combinations 1-49
Right, I want to be able to output all the combinations of 6 numbers which are in range of 1-49 to a listbox. I know there could be thousands and possibly millions but I need to do this. Any help is appreciated.
quote:Original post by Martyn
...I know there could be thousands and possibly millions...
13,841,287,201 combinations actually (That''s billions). If you did have the memory to do it, it wouldn''t be useful to a user. Might I suggest creating 6 list boxes, 1-49 each, right beside each other?
-----------
VenDrake
"My stupid jar is full. I can''t talk to you anymore."
Well, you never said if combos can inclue the same number twice, and if order matters.
OIn the best case you will have to deal with 13,983,816 combinations, not a very small number.
OIn the best case you will have to deal with 13,983,816 combinations, not a very small number.
say what you need help with. is it how to do the list boxes? how to mathematically come up with the numbers? how to programatically to come up with the numbers? what language are you using etc.
imagine you have 10 boxes and 3 balls. How many places can you put the first ball. How many places can you put the second ball? etc. Multiply them together.
The total number of combinations is 10 x 9 x 8 = 720
If all the balls are the same i.e. order doesn't matter then you might have a case where ball 1 is in box 5 and ball 2 is in box 8. You consider this to be the same as ball 1 in box 8 and ball 2 in box 5. You then do the same process for the balls as for the boxes. There are 3 balls how many ways can you choose from them. The first ball you choose you have 3 choices, the second ball you have 2 choices, the third ball you don't have any choice, there's only 1. Altogether you have 3 x 2 x 1 choices = 6. For each combination there are going to be 6 cases the same. So divide the total by 6:
720 / 6 = 120
Do the same for 49 boxes and 6 balls to get the total number.
[edited by - petewood on January 19, 2004 4:47:15 AM]
imagine you have 10 boxes and 3 balls. How many places can you put the first ball. How many places can you put the second ball? etc. Multiply them together.
The total number of combinations is 10 x 9 x 8 = 720
If all the balls are the same i.e. order doesn't matter then you might have a case where ball 1 is in box 5 and ball 2 is in box 8. You consider this to be the same as ball 1 in box 8 and ball 2 in box 5. You then do the same process for the balls as for the boxes. There are 3 balls how many ways can you choose from them. The first ball you choose you have 3 choices, the second ball you have 2 choices, the third ball you don't have any choice, there's only 1. Altogether you have 3 x 2 x 1 choices = 6. For each combination there are going to be 6 cases the same. So divide the total by 6:
720 / 6 = 120
Do the same for 49 boxes and 6 balls to get the total number.
[edited by - petewood on January 19, 2004 4:47:15 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement