RE: Need a algorithm
- To: mathgroup at smc.vnet.net
- Subject: [mg33890] RE: [mg33857] Need a algorithm
- From: "DrBob" <majort at cox-internet.com>
- Date: Sun, 21 Apr 2002 06:14:28 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
If I understand your problem properly, it takes only two lottery tickets, not twelve, to match 3 or more out of 7 numbers drawn from a set of size 12. For instance, let w1 be the first 7 elements of q and let w2 be the last 7. There are 771 lottery draws that share 3 or more numbers with w1, and only 21 lottery draws that do NOT. Those 21 draws each include two elements of w1 and ALL the last 5 elements of q, so they share at least 5 elements (up to 7) with the other ticket, w2. If we're working on k=4, observe that if w1 includes 3 or less winning number, then the last 5 numbers of q include 4 or more of them, so again w1 and w2 is enough. If k=5, it gets harder. w1 and w2 are not enough, since a draw could consist of the first 4 and last 3 elements of q. I believe four tickets are required. That doesn't give you the general algorithm, but it's a start. Bobby Treat -----Original Message----- From: Juan [mailto:erfa11 at hotmail.com] To: mathgroup at smc.vnet.net Subject: [mg33890] [mg33857] Need a algorithm Hi, I ask for help to find an algorithm to resolve this question: There is 36 numbers T={1,2,3,…,36}, and we play 7 numbers, for example : w={3,9,11,19,22,27,33}, then we compare w with the price , for example : p={2,7,11,22,30,31,33}, and in this case we have 3 goods: {11,22,33}. One way to play is to buy for example 1000 w (7 random numbers from T, 1000 times), and to compare each with p, to see if you have been lucky. Another way if to choose 12 numbers from T , for example: q={8,11,13,14,16,22,23,28,31,32,34,35}, and to play for all combinations: Binomial[12,7]=792. If you have q, and you want to get at least k rights, assuming that the numbers in the prize p are in q, then you don’t need to buy all the 792 w. I have bought that for k=3 and I got only 12 w. W= {{8,11,13,14,16,22,23},{8,11,13,14,28,31,32},{8,11,16,22,28,31,34}, {8,11,23,31,32,34,35},{8,13,14,22,32,34,35},{8,13,16,23,28,32,34},{8,14, 16,23,28,31,35},{11,13,14,16,31,34,35}, {11,13,22,23,28,34,35},{11,14,16,22,28,32,35},{13,16,22,23,31,32,35},{14 ,22,23,28,31,32,34}} (This is one of the solutions, and you get at least 3 rights). If you want at least k=5 rights then you have to select more combinations of the all 792. Knowing T=Range[36], q=(n numbers from T) and k<7. How do we get W? Thanks. Juan _________________________________________________________________ MSN Photos es la manera más sencilla de compartir e imprimir sus fotos: http://photos.msn.com/support/worldwide.aspx