#### Archived

This topic is now archived and is closed to further replies.

# 6 Numbers All Combinations 1-49

This topic is 5391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
What part you having trouble with? Generating the numbers or adding them to a listbox?

##### Share on other sites
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."

##### Share on other sites
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.

##### Share on other sites
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]

##### Share on other sites
If you want people to pick their lottery numbers make them pick each ball individually.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632999
• Total Posts
3009812
• ### Who's Online (See full list)

There are no registered users currently online

×