Author 
Message 
PGon?alve #1 / 11

Loto 49/6
how to make all permutations of 5 garanteded in permutations of 6 numbers to 49 numbers? ex permutations of 6 numbers: 1 2 3 4 5 6 1 2 3 4 5 7 1 2 3 4 5 8 1 2 3 4 5 9 etc.. 5 garanteded in permutations of 6 numbers: ?????????????????????

Sun, 24 Jul 2005 04:20:55 GMT 


Rob #2 / 11

Loto 49/6
You do realise don't you that this will yield millions of combinations? Why do you need to do it? Whatever your reasons, there's probably a much easier approach. Rob
Quote: > how to make all permutations of 5 garanteded in permutations of 6 numbers to > 49 numbers? > ex permutations of 6 numbers: > 1 2 3 4 5 6 > 1 2 3 4 5 7 > 1 2 3 4 5 8 > 1 2 3 4 5 9 > etc.. > 5 garanteded in permutations of 6 numbers: > ?????????????????????

Sun, 24 Jul 2005 07:59:06 GMT 


PGon?alve #3 / 11

Loto 49/6
i know that there are millions of permutations but you know the code to do that?

Tue, 26 Jul 2005 01:48:30 GMT 


Mauree #4 / 11

Loto 49/6
Actually, the method you specify for listing the number of possible "sets of six" from a "set of of 49" is not correct, because if you carry on your list in the way that you have started it you will end up with all possible arrangements of six objects from a set of 49 objects, which will include many, many cases where the same set of six objects is presented in all the possible ways it can be. In other words, if you start with a list of 49 numbered lottery balls and draw six balls at random then your entire list will contain that specific set of six in the exact order in which they were drawn. The total number of these combinations is 49 * 48 * 47 * 46 * 45 * 44, which is 10068347520. However, in a lottery you just need the six drawn numbers, and you do not need them in a specified order. Since any set of six objects can be arranged in 720 different ways (6 * 5 * 4 * 3 * 2 * 1) then the total number of possible arrangements (10068347520 as already stated) will contain *all 720 arrangements* of each set of six numbers. This means that in order to guarantee that you will get the six drawn numbers you would have to buy 10068347520 divided by 720 tickets. That is 13983816 tickets (nearly four{*filter*} million tickets). Now we come to examine what happens if you only need five of these six numbers to be correct . . . Oh {*filter*} . . . I've lost interest now. I've just realised how much chance I've really got of winning the lottery this week! Mike
Quote: > how to make all permutations of 5 garanteded in permutations of 6 numbers to > 49 numbers? > ex permutations of 6 numbers: > 1 2 3 4 5 6 > 1 2 3 4 5 7 > 1 2 3 4 5 8 > 1 2 3 4 5 9 > etc.. > 5 garanteded in permutations of 6 numbers: > ?????????????????????

Tue, 26 Jul 2005 21:37:48 GMT 


Martin Trum #5 / 11

Loto 49/6
rdlemSPAMOK.freeserve.co.uk> writes Quote: >Actually, the method you specify for listing the number of possible "sets of >six" from a "set of of 49" is not correct, because if you carry on your list >in the way that you have started it you will end up with all possible >arrangements of six objects from a set of 49 objects, which will include
Just my one pennyworth added to Mike's lucid explanation. Think 'combinations' not 'permutations'. They're not the same. Regards.  Martin Trump

Wed, 27 Jul 2005 01:35:33 GMT 


George Weis #6 / 11

Loto 49/6
Quote:
> i know that there are millions of permutations > but you know the code to do that?
Hi there... Try this code..... I am sure you can improve on it But its a start Good luck George  Option Explicit Private Sub cmdGo_Click() 'This program displays the combinations 'of n items taken k at a time ' On a form, place ' 2 text boxes Text1, Text2 ' 1 button cmdGo ' 2 list boxes List1(0), List1(1) ' 2 Labels Label1, Label2 ' ' Text1 is n, Text2 is k; start with Text1.Text=5 and Text2.Text=3 ' Program Limitation: Memory Dim n%, k% Dim D$, d1$, lst$ Dim i%, j%, l%, ii% Dim Sum1#, Sum2#, Num& Dim Times# Dim ret& List1(1).Clear n = Val(Text1.Text) k = Val(Text2.Text) If k > n Then Exit Sub If k = 0 Then k = n Sum1 = 1 Sum2 = 1 ' n!/(nk)! For i = n To n  k + 1 Step 1 Sum1 = Sum1 * i Next ' k! For i = k To 1 Step 1 Sum2 = Sum2 * i Next ' Number of combinations Num = Sum1 / Sum2 Label1.Caption = Num & " combinations" If Num >= 6430 Then ret = MsgBox("There are " & Num & " combinations" & vbCrLf & "Do you want to go on ?", vbYesNo) If ret = 7 Then Exit Sub End If Times = Timer For i = 1 To n List1(1).AddItem Format(i, "00 ") Next ii = 1 For j = 2 To k lst = j Mod 2 List1(lst).Clear For i = 1 To n For l = 0 To List1((lst + 1) Mod 2).ListCount  2 D = List1((lst + 1) Mod 2).List(l + ii) d1 = Format(i, "00 ") If i <= Val(Left$(D, 3)) And InStr(D, d1) = 0 Then List1(lst).AddItem Format(i, "00 ") & D End If Next Next ii = ii + 1 Next Times = Timer  Times Label2.Caption = Format(Times, "0.0000") & " sec" lst = j Mod 2 List1(lst).Clear lst = (j + 1) Mod 2 List1(lst).ZOrder List1(lst).Refresh End Sub

Fri, 29 Jul 2005 06:25:58 GMT 


michael harringto #7 / 11

Loto 49/6
Quote: > i know that there are millions of permutations > but you know the code to do that?
Try the following... Option Explicit Private Sub Command1_Click() Dim a As Long, b As Long, c As Long Dim d As Long, e As Long, f As Long Dim n As Long, count As Long n = 49 '6 from 49 lotto For a = 1 To n  5 For b = a + 1 To n  4 For c = b + 1 To n  3 For d = c + 1 To n  2 For e = d + 1 To n  1 For f = e + 1 To n count = count + 1 Print "No"; count; ":"; a; b; c; d; e; f Print , "subsets of 5 From 6" Print , a; b; c; d; e Print , a; b; c; d; f Print , a; b; c; e; f Print , a; b; d; e; f Print , a; c; d; e; f Print , b; c; d; e; f Print "" If count > 4 Then Exit Sub 'demo only, change to suit Next f, e, d, c, b, a Print count End Sub

Sat, 30 Jul 2005 06:58:15 GMT 


Mauree #8 / 11

Loto 49/6
Right. We're getting somewhere now. Your code (correctly, I think) calculates that there are 83,0902,896 distinct combinations of "any five from 6" drawn from a total set of 49, and it correctly lists them. That's more of a result than I have achieved so far! Additionally, my own posting tells the OP that there are a total of 13,983,816 combinations of "any six from 49". That means that it is six times easier to get "five from six" than it is to get all six. Sounds good to me. So, since each of these combinations of "any six from 49" itself contains a total of six separate "sets of five" (6*5*4*3*2*1 / 5*4*3*2*1) then it follows (or does it?) that the number of tickets the OP needs to buy to guarantee that he has a set of five from his six "ticked" ball numbers (drawn from a full set of 49 balls) is 13,983,816 / 6 = 2,330,636 tickets. That's a lot of tickets, and I suspect that the OP wants to know which set of six numbers to write on each of them! {*filter*}! My head is really spinning now! Hope I've got this stuff right! Over to you, Michael ;) But wait! Surely that can't be right, because it would mean that the chances of getting all 6 of the six drawn numbers after ticking six of the 49 boxes would actually be better than the chances of getting just five of the six drawn numbers together with a seventh drawn "bonus" ball! Surely that can't be right! They pay lots more cash for "all six" than they do for "all five from six plus the bonus ball" {*filter*}! My head really hurts now! Perhaps I should drink this Budweiser a little more slowly. Or maybe even go back to my old "standby" of whisky and Coke. Gets you drunk even more quickly, and you don't have to go to the toilet so often! Lovely stuff :) Mike
Quote:
> > i know that there are millions of permutations > > but you know the code to do that? > Try the following... > Option Explicit > Private Sub Command1_Click() > Dim a As Long, b As Long, c As Long > Dim d As Long, e As Long, f As Long > Dim n As Long, count As Long > n = 49 '6 from 49 lotto > For a = 1 To n  5 > For b = a + 1 To n  4 > For c = b + 1 To n  3 > For d = c + 1 To n  2 > For e = d + 1 To n  1 > For f = e + 1 To n > count = count + 1 > Print "No"; count; ":"; a; b; c; d; e; f > Print , "subsets of 5 From 6" > Print , a; b; c; d; e > Print , a; b; c; d; f > Print , a; b; c; e; f > Print , a; b; d; e; f > Print , a; c; d; e; f > Print , b; c; d; e; f > Print "" > If count > 4 Then Exit Sub 'demo only, change to suit > Next f, e, d, c, b, a > Print count > End Sub

Sat, 30 Jul 2005 02:17:48 GMT 


PGon?alve #9 / 11

Loto 49/6
Thanks for your help but its not like you say Its hard to me explain this in englis but ill try there are 13983816 combinations of 6 in 49 numbers there are 1906884 combinations of 5 in 49 numbers with 6 numbers we have 6 combinations of 5 exemple: 1,2,3,4,5,6: 1,2,3,4,5 1,2,3,4,6 1,2,3,5,6 1,2,4,5,6 1,3,4,5,6 2,3,4,5,6 So we have 1906884 / 6 = 317814 results for 5 combinations using 6 numbers to 49 total numbers i wrote a program that gives all combinations of 6 numbers in 49 What i want to do know is a program that gives me all combinations of 5 with 6 numbers for 49 in total it maybe looks like this: 1 2 3 4 5 6 1 2 3 4 7 8 1 2 3 4 9 10 1 2 3 4 11 12 1 2 3 4 13 14 1 2 3 4 15 16 1 2 3 4 17 18 1 2 3 4 19 20 1 2 3 4 21 22 1 2 3 4 23 24 1 2 3 4 25 26 1 2 3 4 27 28 and so one.. my program that gives all combinations of 6 numbers to 49 is: Do While x1 <= 44 Do While x2 <= 45 Do While x3 <= 46 Do While x4 <= 47 Do While x5 <= 48 Do While x6 <= 49 x6 = x6 + 1 Loop x5 = x5 + 1 x6 = x5 + 1 Loop x4 = x4 + 1 x5 = x4 + 1 x6 = x5 + 1 Loop x3 = x3 + 1 x4 = x3 + 1 x5 = x4 + 1 x6 = x5 + 1 Loop x2 = x2 + 1 x3 = x2 + 1 x4 = x3 + 1 x5 = x4 + 1 x6 = x5 + 1 Loop x1 = x1 + 1 x2 = x1 + 1 x3 = x2 + 1 x4 = x3 + 1 x5 = x4 + 1 x6 = x5 + 1 Loop

Sat, 30 Jul 2005 08:18:44 GMT 


michael harringto #10 / 11

Loto 49/6
Quote: > Right. We're getting somewhere now. Your code (correctly, I think) > calculates that there are 83,0902,896 distinct combinations of "any five > from 6" drawn from a total set of 49, and it correctly lists them. That's > more of a result than I have achieved so far! Additionally, my own posting > tells the OP that there are a total of 13,983,816 combinations of "any six > from 49". That means that it is six times easier to get "five from six" than > it is to get all six. Sounds good to me. So, since each of these > combinations of "any six from 49" itself contains a total of six separate > "sets of five" (6*5*4*3*2*1 / 5*4*3*2*1) then it follows (or does it?) that > the number of tickets the OP needs to buy to guarantee that he has a set of > five from his six "ticked" ball numbers (drawn from a full set of 49 balls) > is 13,983,816 / 6 = 2,330,636 tickets. That's a lot of tickets, and I > suspect that the OP wants to know which set of six numbers to write on each > of them! {*filter*}! My head is really spinning now! Hope I've got this stuff > right! Over to you, Michael ;) > But wait! Surely that can't be right, because it would mean that the chances > of getting all 6 of the six drawn numbers after ticking six of the 49 boxes > would actually be better than the chances of getting just five of the six > drawn numbers together with a seventh drawn "bonus" ball! Surely that can't > be right! They pay lots more cash for "all six" than they do for "all five > from six plus the bonus ball" {*filter*}! My head really hurts now! > Perhaps I should drink this Budweiser a little more slowly. Or maybe even go > back to my old "standby" of whisky and Coke. Gets you drunk even more > quickly, and you don't have to go to the toilet so often! Lovely stuff :) > Mike
Mike, I spotted the error in your logic straight away! Although your move from whiskey & coke to Bud was sound, you should have further upgraded from Bud to Toohey's New (bottled, not canned). This makes for smoother mellower coding sessions and gives searing insights into combinatronics! Oh, and the lotto.. I use hypogemetric function (in Excel but easily whipped up in VB) for lotto and keno computations. So odds of matching 5 of our selected six are.. 6C5 *times(496)C(65) divided by 49C6 = (6*43)/13983816. Now, 5 of our 6 numbers have been matched. What are the odds that our 6th number will be the supplementary? There are only 43 left in the barrel so odds of 5 plus supp are...(6*43)/(13983816*43) = 6/13983816. The way I see it, if the OP wants to be certain of matching 5 from six he must still blanket the lotto with all 13,983,816 tickets but will be consoled by getting the major prize once and 5 out of 6 some 43 times! Cheers Mick.

Sat, 30 Jul 2005 20:25:24 GMT 


Mauree #11 / 11

Loto 49/6
Yes. The fog is lifting. Now I can see exactly what you mean. Everything suddenly becomes clear. This Budweiser really *is* too "watery". Toohey's New (bottled) *is* much smoother than Bud. A delicious, smooth, creamy flavour that tantalises the taste buds and certainly seems to reach the parts that other beers just cannot reach. Visual Basic code flows much more freely. Even some of the MSDN help files begin to make sense. I wonder why they didn't include a mention of this wonderful Toohey's beverage in Service Pack 5? Would have solved a lot of problems. Mike
Quote: > Mike, I spotted the error in your logic straight away! Although your move > from whiskey & coke to Bud was sound, you should have further upgraded > from Bud to Toohey's New (bottled, not canned). This makes for smoother > mellower coding sessions and gives searing insights into combinatronics! > Oh, and the lotto.. > snip <

Sat, 30 Jul 2005 14:33:25 GMT 


