No worries, I think your solution coverges with @Someone's above, if I am not mistaken. You're multiplying the probabilities for all values of j up to i for all values of i.
edit - actually, the calculations from the other guy are probability calculations, so this is related to the median. I have given you a mean calculation, which should be related to the average. But you already mentioned that they are close ...
Comments
Expected index given by
E [X] = \sum_{i \in [2,100)} p(X < i)\prod_{j < i}p (X \ge j)i.
Edit: Sorry rest of reply was wrong. Had to account for not hitting until i^th loop.
Not sure that adds up, I translated the right side of the equality into a Python statement and it returns a number I am not sure how to interpret:
Both the median and mean are around 12 for 10K runs of the loop.I edited my response with an apology! Thanks for checking!
No worries, I think your solution coverges with @Someone's above, if I am not mistaken. You're multiplying the probabilities for all values of j up to i for all values of i.
Yes I am and yes I think it does:
edit - actually, the calculations from the other guy are probability calculations, so this is related to the median. I have given you a mean calculation, which should be related to the average. But you already mentioned that they are close ...