Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() Quote:
It is part of a lottery strategy, but it does imply buying all the 320 combinations (which I'll explain why I think there is only 320 combinations later), therefore guaranteeing at least one win of the 4 out of 6 prize. Also I just want to point out that English isn't my native language, sometimes I run out of word to properly explain my thought :) Quote:
Just to make sure that I'm properly understood, I want to clarify a point. In my 4 out of 6 unique combinations, the 4 out of 6 has to be completely unique: If you take 1,2,3,4,5,6 as my starting combination, the other combinations will not be able to have the following inside of them: 1,2,3,4 2,3,4,5 3,4,5,6 1,3,4,5 1,4,5,6 2,4,5,6 1,2,4,5 1,2,5,6 1,3,4,6 1,3,5,6 1,4,5,6 So for the script to work properly, the next logical combination would be 1,2,3,7,8,9 since 1,2,3,4,5,7 wouldn't be an acceptable one. Also, starting with the first combination being 2,3,4,5,6,7 then this creates a different list of combinations, with different exclusions. I hope this makes more sense? Quote:
Please let me know if you need more info :) Thanks! |
#2
![]() |
|||
|
|||
![]()
[Hello Martin,
i think that right answer is 58 905 rows. Try these macros. I suppose that you know about macros, so that you can try these ones. First takes about 10 mins and second taken about 2 minutes. best regards |
#3
![]() |
|||
|
|||
![]() Quote:
Thank you for the VBA script, unfortunately that gives me 4 numbers combinations, which doesn't work for what I need; I need 6 numbers combination with a unique 4 numbers combinations inside of it. While this script would give me the first 4 numbers, it wouldn't detect a match in the rest of the combinations, when the extra 2 numbers are added. For example: If the script gives me this: 1,2,3,4 1,2,3,5 1,2,3,6 1,2,3,7 I need to add the extra two digits, which will then create duplicate unique 4 numbers within the combination: 1,2,3,4,5,6 1,2,3,5,6,7 Here you have 1,2,3,5 & 1,2,3,6 & 1,2,5,6 & 1,3,5,6 & 2,3,5,6 that matches in both combinations. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Martin-888" wrote:
It is part of a lottery strategy, but it does imply buying all the 320 combinations [...], therefore guaranteeing at least one win of the 4 out of 6 prize. Sounds like a scam. Please provide a URL (http://...) for the website that describes the strategy or offers the product. Also, please provide a URL (http://...) for the particular lottery. "Martin-888" wrote: I'm not very good in math, but since there is 1 chance out of 320, it made me believe that there was many groups of 320 combinations. No. For example, there are 6525 ways (tickets) of matching exactly 4 out of 6 numbers drawn. That translates into about a 1 in 298.5 chance of matching exactly 4, since there are 1,947,792 possible drawings (tickets) of 6 out of 36 numbers. I still do not understand where 320 comes from. That is why I would like the URLs that I requested above. They probably don't explain the math directly. But they might have information that I can use to intuit the computation. For now, I stand by my finding that you would have to buy 2240 tickets in order to be sure to match at least 4 of 6. Of course, that makes sense to do only if the payout for matching exactly 4 is more than $2240, assuming $1 per ticket. (And of course, by "$", I mean whatever your currency is.) I suspect you will find that the payout is much smaller. Otherwise, everyone would be doing this. "If it sounds too good to be true, it usually is". "Martin-888" wrote: In my 4 out of 6 unique combinations, the 4 out of 6 has to be completely unique [....] Is this how you first understood my question Yes. You can download the file "uniq 4 from 6 of 36.xls" from https://www.box.com/s/2a361ad6de78e8f4865e. Columns A and B are somewhat configurable by changing A1, A2 and A3. However, the table starting at A11 might need to be adjusted manually. The macro that generates the results in columns D through I is hardwired for the particular parameters that you mentioned, namely: drawing 6 of 36 numbers, and generating all combinations with unique sets of 4 numbers. I hardwired the numbers in order to ensure the best performance. The worksheet and macro might not be very self-explanatory. Let me know if you have any questions or comments. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote:
"Martin-888" wrote: It is part of a lottery strategy, but it does imply buying all the 320 combinations [...], therefore guaranteeing at least one win of the 4 out of 6 prize. Sounds like a scam. Please provide a URL (http://...) for the website that describes the strategy or offers the product. Aha! I believe you are talking about what is called "lottery wheels" and "lottery wheeling" in English. But I believe you might have misunderstood some details. And quite understandably so, especially if you are reading English descriptions, and English is not your native language, as you indicated. I found it difficult to understand some of the details, and English __is__ my native language :-). I finally "got it" after reading several descriptions and examples. I wrote: For now, I stand by my finding that you would have to buy 2240 tickets in order to be sure to match at least 4 of 6. I am even more confident now that I correctly "wheeled" the full set of 36 numbers to guarantee "a minimum 4-number match", as the "wheelers" put it. I will be double-checking my algorithm later, just to be sure I don't have a defect. Nevertheless, I suspect that is not exactly what you wanted, at least not according to one detail that you posted. I wrote: "Martin-888" wrote: I'm not very good in math, but since there is 1 chance out of 320, it made me believe that there was many groups of 320 combinations. [....] I still do not understand where 320 comes from. I believe I do, now. But I wonder if you really meant to write 1 chance in 389, 325, or 315, not 320. There are two common flavors of lottery wheeling: full wheel and abbreviated wheel. (There are other flavors, as well.) With a full wheel, you typically choose a subset of the 36 numbers, say 18 numbers. Then we generate __all__ combinations of 6 of the __18__ numbers, not 36, with unique sets of 4. That would be a total of 42 combinations in this case. With an abbreviated wheel, again you choose a subset of the 36 numbers, say 18 numbers. Then we generate a __subset__ of the combinations 6 of the __18__ numbers with unique set of 4. That would be fewer than 42 combinations in this case. (See below for how we define the subset of qualified combinations.) The key difference is the condition under which the wheel "guarantees" a minimum 4-number match. With a full wheel, a minimum 4-number match is "guaranteed" as long as __all_6__ of the drawn numbers (by the lottery) are in your subset of 18 numbers. With an abbreviate wheel, a minimum 4-number match is "guaranteed" as long as, for example, at least __4__ of the 6 drawn numbers are in your subset of 18 numbers. At issue is the word "guaranteed". It is really a __conditional__ guarantee. Given the condition for full wheels ("all 6 of the drawn numbers are in your subset"), the probability that the condition is met is COMBIN(18,6) / COMBIN(36,6) for a subset is 18 numbers. Similarly, for abbreviated wheels, the probability that the condition ("at least 4 of the drawn numbers are in your subset") is met is COMBIN(18,4) / COMBIN(36/6). This is where the "1 chance in 320" comes from: ostensibly, COMBIN(k,6) / COMBIN(36,6) is 1/320 for some subset of k numbers. However, I am unable to find any k for which the conditional probability is exactly 1/320. It would be 1/389 (1 chance in 389) for a full wheel with a subset of 15 numbers. It would be 1/325 for an abbreviated wheel with a subset of 21 numbers and the condition that at least 4 of the 6 drawn numbers are in the subset. And it would be 1/315 for an abbreviated wheel with a subset of 17 numbers and the condition that at least 5 of the 6 drawn numbers are in the subset. Does any of that sound familiar -- closer to the facts in your circumstance? I wrote: Of course, that makes sense to do only if the payout for matching exactly 4 is more than $2240, assuming $1 per ticket. I neglected to also take into consideration other possible lesser matches with some of the other combinations. That is too complicated to explain further. I hope you can imagine what I mean. PS: It might useful if I modify my algorithm to handle any full and abbreviated wheel characteristics. Something for the future. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Errata.... I wrote:
Given the condition for full wheels ("all 6 of the drawn numbers are in your subset"), the probability that the condition is met is COMBIN(18,6) / COMBIN(36,6) for a subset is 18 numbers. Similarly, for abbreviated wheels, the probability that the condition ("at least 4 of the drawn numbers are in your subset") is met is COMBIN(18,4) / COMBIN(36/6). While I believe the full-wheel conditional probability is correct, I have my doubts about the formula for the abbreviated-wheel conditional probability. I need to give that more thought. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "joeu2004" wrote in message ... Errata.... I wrote: Given the condition for full wheels ("all 6 of the drawn numbers are in your subset"), the probability that the condition is met is COMBIN(18,6) / COMBIN(36,6) for a subset is 18 numbers. Similarly, for abbreviated wheels, the probability that the condition ("at least 4 of the drawn numbers are in your subset") is met is COMBIN(18,4) / COMBIN(36/6). While I believe the full-wheel conditional probability is correct, I have my doubts about the formula for the abbreviated-wheel conditional probability. I need to give that more thought. =COMBIN(36,6) That returns 1947792 which is indeed the number of 6-number combinations my routine churns out before 'filtering'. Now if you can derive some formula that returns 16431 for the filtered '4 out of 6' that would validate my routine! Regards, Peter T |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Peter T" wrote:
Now if you can derive some formula that returns 16431 for the filtered '4 out of 6' that would validate my routine! I have tried to count this in the past, and I believe I never succeeded. That is why I would like to see your 16,431 combinations. My algorithm generated 2240; and I do not see any mistake (yet). I posted a pointer to my uploaded file in another response. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 14/07/2012 18:22, joeu2004 wrote:
"Peter T" wrote: Now if you can derive some formula that returns 16431 for the filtered '4 out of 6' that would validate my routine! I have tried to count this in the past, and I believe I never succeeded. That is why I would like to see your 16,431 combinations. My algorithm generated 2240; and I do not see any mistake (yet). I posted a pointer to my uploaded file in another response. My algorithm also generated 2240 for the base case with no repetitions using a greedy take exactly 15 matches at a time only approach with a starting seed value of 0x3f = 63 = 00111111b first time around. But if I choose a random 6 bits are 1 starting seed instead I can get slightly different values - best so far is from 0x333 = 1100110011b with 2244 hits followed by 0xAAA = 101010101010b with 2242 hits and the worst so far 0x111111 with only 2233 hits. I wonder if there is some neat way to generate manually by construction a better set of test patterns instead of the entire 6/36 ~2M entries. The closest I can think of is to use the structure of the problem 6C36 and treat it at a nested case of 3C6 6 bit long patterns placed in 2C12 positions and zero padded. (And also 6 bits all set in 6 positions) 3C6 = 6!/3!^2 = 20 2C12 = 12.11/2 = 76 My back of the envelope reasoning is that the 3C6 binary patterns can have at most 2 matching bits in common and so the subset this generates which contains 76.20.20 = 30400 elements all have less than or equal to 4 matching bits and might therefore stand a better chance of spanning the space more efficiently than the brute force greedy method. I haven't thought of a neat way to set the problem up that will allow an efficient search of the very large space for a global optimum. Like you I think the greedy method may not be optimal but cannot prove it. So far my results are by trial and error. -- Regards, Martin Brown |
#10
![]() |
|||
|
|||
![]()
Thank you everyone for looking into this, I think joeu is right, it is 2240 tickets that I would need to make sure that I win 4 out of 6 and not 320. I'm not very good at math, I will not comment all the technical details that you guys provided, as I don't understand them properly :)
Here is the link of the game: http://lotoquebec.com/loteries/nav/e...dds-of-winning They may have rounded the chances of win to 320 from a different number... since you guys cannot get to 320. I wasn't looking for a way to win more money that I would be paying for the tickets everytime, but more looking for a cheaper way of buying many tickets, increasing the chance of winning the 6/6 prize. Thanks everyone for your help on this, especially joeu :) Martin |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Martin-888" wrote:
I think joeu is right, it is 2240 tickets that I would need to make sure that I win 4 out of 6 Actually, the correct number is 5456. For details, see my response to PeterT at 1:36 PM on July 15 Pacific Time. In a nutshell, I believe we are discussing two different problems. Problem #1: find all combinations with unique sets of 4-number subsets ("quads"). Problem #2: find the minimum number of combinations that guarantees matching 4 of 6 drawn numbers. I think we both assumed that a solution to Problem #1 is also a solution to Problem #2. Now I realize that is incorrect. In order to generate the minimum number of combinations that truly guarantees a match of 4 out of 6 drawn numbers, we must allow some combinations to have duplicate quads. Again, see my response to PeterT for details. "Martin-888" wrote: Here is the link of the game: http://tinyurl.com/7pvqqwe They may have rounded the chances of win to 320 from a different number... since you guys cannot get to 320. Oh, I can compute __that__ probability very easily. The important thing is: that probability is very different from the conditional probability for full and abbreviated wheels, which I had thought your were referring to. The probability 1/320 has nothing to do with the minimum number of combinations that guarantees matching 4 of 6 drawn numbers. Moreover, when you see probabilities like 1/320, it usually does not mean that we have counted only 320 of something. Instead, it is usually the result of dividing one number by another. In this case, there are 6090 ways to match 4 of 6 drawn numbers, and there are 1,947,792 total combinations of 6 of 36 numbers, what the player chooses. So the probablility is 6090/1947792. Equivalently, the denominator of the odds ("1 out of ...") is 1947792/6090, which is about 319.83. That's where 1/320 comes from. (The obvious rounding was never an issue.) ----- For the benefit of anyone who might want some mathematical details, the key to counting 6090 lies in the procedure for this particular lottery, Canada's "Jour de Paye". The lottery (not the player) actually draws 7 of 36 numbers, not just 6 of 36. The 7th number is designated as a "bonus" number. When the lottery speaks of matching "4 of 6", they mean 4 of the first 6 drawn numbers. When they speak of matching "4 of 6 plus bonus", they mean that the player's 6 numbers includes 4 of the first 6 drawn numbers and the 7th bonus number. (Note: This is very different from the powerball-type lotteries that I am familiar with, where the bonus ball is drawn from a separate set of numbers, and the player chooses a bonus number in addition to the "normal" numbers, just as the lottery does.) Consequently, the number of ways to match 4 of 6 drawn numbers (and not the bonus) is COMBIN(6,4)*COMBIN(29,2). That is: the number of ways to match 4 of 6 drawn numbers, times the number of ways to choose 2 more numbers (for a total of 6) from the set of numbers that does not include any of the 7 drawn numbers (29 = 36 - 7). Note: The count 6525 that I posted before was calculated by COMBIN(6,4)*COMBIN(30,2). That would be correct if the lottery drew only 6 balls. I was unaware of the "Jour de Paye" procedures until now, when Martin finally provided the link to the game. |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
PS.... I wrote:
"Martin-888" wrote: I think joeu is right, it is 2240 tickets that I would need to make sure that I win 4 out of 6 Actually, the correct number is 5456. [....] there are 6090 ways to match 4 of 6 drawn numbers, and there are 1,947,792 total combinations of 6 of 36 numbers, what the player chooses. So the probability is 6090/1947792. I suspect those two statements might cause some confusion. Let me clarify.... There are 6090 combinations that match 4 of a __specific__ 6 drawn numbers. But we need 5456 combinations (carefully chosen) to match at least 4 of __all_possible__ 6 drawn numbers. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sum up combinations of numbers from list to get specific total | Excel Discussion (Misc queries) | |||
Unique combinations of records in a list | Excel Programming | |||
Unique random numbers from list | Excel Discussion (Misc queries) | |||
List of unique texts and numbers | Excel Worksheet Functions | |||
how to extract unique numbers once from a list of repeated numbers? | Excel Discussion (Misc queries) |