简体   繁体   中英

understanding lotto program logic by skiena

I am reading article from following location. Here is text snippet form document.

Link

The problem of finding a minimum set of tickets that will guarantee a win is not a trivial one. Given that P out of R outcomes will be from the fortune-teller set, it is not difficult to see that there are NCP = (N/P!)/(NP)! possible P-subsets from the fortune-teller set that can occur in the winning ticket. If we were to pick all P-subsets from the fortune-teller set W times and fill in the remaining RP slots arbitrarily, the set of tickets obtained will have at least W occurrences of each P-subset and guarantee us W wins. However, such a set need not be a minimal one and in most cases is not.

We know from the fortune-teller's promise that one of the P-subsets will occur in the winning ticket. It is possible for two P-subsets to differ by less than J numbers. When such a situation arises, the subsets are said to overlap or cover one another with respect to the shared J numbers and only one of the P-subsets must be in a purchased ticket. This phenomenon is best illustrated using an example. Suppose we are playing the PICK-4 Lotto and require one 2/4 win. Hence R=4, J=2 and W=1. Furthermore let's assume that the fortune-teller predicts 3 numbers from a set of 5 numbers ( ie P=3 and N=5 ). If all P-subsets were taken from the fortune-teller set and arbitrarily filled to complete the tickets, we would have a set of ten tickets that guarantees one 2/4 win ( See Figure 1 ). However, it is also possible to exclude some tickets from this set because of several two-number overlaps. For instance the subset {3, 4, 5} is different than {1, 3, 5} by only one number and it will be wasteful to use both of these in purchased tickets. We might think that not including {3, 4, 5} will permit the possibility of losing, but that is not the case since if {3, 4, 5}occurs we will have '3' and '5' in {1, 3, 5}that we bought to claim the prize! Similarly there can be many more redundant P-subsets. An optimal solution is shown in Figure 2. Our lottery problem is that of finding the smallest set of P-subsets from the fortune-teller set that guarantees the specified number of wins by keeping the number of overlaps to a minimum. This set of P-subsets defines the winning set regardless of what numbers are used to complete the R slots on the ticket.

My question are followiong

  1. As author metioned "If all P-subsets were taken from the fortune-teller set and arbitrarily filled to complete the tickets, we would have a set of ten tickets" As in article table is missing can any one help me here what are the 10 tickets?

  2. In above example if 1 and 3 occurs and if we didn't select {1, 3, 5} how can we win here?

  3. Can anyone come up with fig 2 which is missing in article?

thank!

  1. Here is an inefficent list of 10 tickets

     {1, 2, 3, 6} {1, 2, 4, 6} {1, 2, 5, 6} {1, 3, 4, 6} {1, 3, 5, 6} {1, 4, 5, 6} {2, 3, 4, 6} {2, 3, 5, 6} {2, 4, 5, 6} {3, 4, 5, 6} 
  2. Mu. To win we need to match 2 out of 4. So it isn't the case that 1 and 3 occurs, it is the case that a specific set of 3 occurs and we only need to match 2 of them.

  3. I think this is optimal.

     {1, 2, 3, 4} 

But I'm not entirely positive that I can pick 4. If I am only allowed to pick 3 per ticket then an optimal set would be:

    {1, 2, 3}
    {2, 3, 4}

The two tickets are:

{ 1, 3, 5, X }

{ 2, 4, 5, X }

where X is an arbitrarily chosen number which does not affect the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM