-1

I want to maximize the total probability of winning in a game of random selection which is played as follows,

I have n lottery tickets and out of these n only 1 is the lucky ticket, now I have 2 option either draw a ticket or ask the master to remove some X unlucky ticket out of total tickets, X must be a multiple of k (available) and X must be smaller than total number of tickets.

If i draw an unlucky ticket master will add k unlucky tickets to the pile of tickets.

We have at max m moves to play, each move is one of the following

  1. Either we draw a ticket
  2. Either we ask master to remove X tickets (X is multiple of k)

I want to maximize the probability.

And output the total probability P/Q as P*Q^(-1) where Q is modular inverse of Q.

After observing and playing the game I think the total probability will be maximum only when we play the game in the following way

  1. First move we draw a ticket and probability of winning is 1/n.

  2. If we draw an unlucky ticket in first move k tickets are added and we can ask the master to remove k tickets in second move.

  3. In third move we again draw ticket and probability of winning now is
    ((n-1)/n)*(1/n) .

Similarly if there are m moves than we can conclude that, total probability of winning is (1-((n-1)/n)^r) where we can find value of r

n

for example : n = 3 k = 20 m = 3

total probability is 1-(2/3)^2 = 5/9

n = 5 k = 7 m = 1

total probability of winning is = 1/5

Final output :

5*(9)^(-1) % 1000000007 = 555555560

1*(5)^(-1) % 1000000007 = 400000003

If there is other winning strategy in this game please provide it with proof and i don't have a proof for my strategy too so if you can prove my strategy i will be glad to have it as well as a psuedocode will help me to proceed.

we again put the ticket that we picked in the pile again so after drawing wrong we have n+k instead of n+k-1, and also n < k ( for the starting always)

EDIT : Proof of my strategy

for each move we take there are 2 possibilities

either we gain 1/n*(n-1)/n or we gain (n-1)/n*(1/n+k) + (n-1/n)((n+k-1)/n+k)(1/n+2*k)

now after solving both sides we get to equation 1/n left hand side and right hand side is (2*n+3*k-1)/((n+2*k)*(n+k) and i found that R.H.S is always less than or equals to R.H.S

So after further solving i get L.H.S as 2*(k^2) and R.H.S as n^2-n and as given n < k so L.H.S is always greater than R.H.s

Hence proved.

Please provide feedback for the proof.

cooldude
  • 63
  • 10

1 Answers1

1

Your strategy is incorrect. After drawing an unlucky ticket, you would ask the master to remove k tickets, but if you had started playing in exactly the same state, you would have picked a ticket instead. That does not make sense, because the game has no memory of your previous moves, and the present situation should therefore always dictate the best choice.

Let P(n,m,k) be the probability of winning with n tickets, max m moves, and k, with optimal strategy.

If you pick a ticket, then the probability is 1/n + P(n+k-1, m-1, k)*(n-1)/n.

If you don't then the probability is P(n-k, m-1, k)

The optimal choice is the one with best probability, and so:

P(n,m,k) = max( 1/n + P(n+k-1, m-1, k)*(n-1)/n , P(n-k, m-1, k) )

You can could calculate this recursively, with memoization since there are likely to be overlapping subproblems, i.e., with dynamic programming.

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87
  • my solution is correct too, please have a look at my proof in recent edits and thanks for DP approach – cooldude Feb 04 '19 at 04:58