I heard this brainteaser from someone else and found it is interesting. Can someone help me on solving this problem? Thanks so much for your help...
There are n slots totally. You have access to infinitely many balls and put balls one-by-one into the slots randomly - each ball has equal probability to get into each slot. You can stop early anytime. In the end your pay out will be like this: for each 1-ball slot, you are rewarded 1; for each k-ball slot (k>=2), you are penalized k; for each 0-ball slot you are rewarded nothing. What is your optimal strategy? And what is the expected value of the game under the optimal strategy?
Let $Y$ be the payout. Let $Z$ be the count of balls. We want to find the value of $N$ when the expected payout given the count of balls used is a maximum.
$$\frac{\mathrm d~}{\mathrm d z}\mathsf E(Y\mid Z=z) = 0$$
Let $X_i$ be the count of balls in slot $i$. $$X_i\mid Z{=}z ~\sim~\mathcal{Bin}(z, 1/n)$$
Let $Y_i$ be the payout for that slot. $Y_i=\begin{cases} 1 & :X_i=1 \\ -X_i & :\textsf{otherwise}\end{cases}$
Then $$\begin{align} \mathsf E(Y\mid Z{=}z) ~=~& \sum_{i=1}^n \mathsf E(Y_i\mid Z{=}z) \\[1ex] ~=~& \sum_{i=1}^n \Big(\mathsf P(X_i{=}1\mid Z{=}z)-\mathsf P(X_i{\neq} 1\mid Z{=}z)~\mathsf E(X_i\mid X_i{\neq}1 , Z{=}z)\Big) \\[1ex] ~=~& \sum_{i=1}^n \Big(2~\mathsf P(X_i{=}1\mid Z{=}z)-\mathsf E(X_i\mid Z{=}z)\Big) \end{align}$$
...can you complete?