Suppose there are N types of surprise mystery toys uniformly distributed in cereal boxes. How many boxes would a kid have to buy to collect them all on average? Now suppose there are M kids efficiently trading. How many boxes sold before all kids have all toys?
-
-
Expectation is linear, so it's the sum from i = 1 to n of the expected number of boxes you need to open to get something you don't already have given that you have i things already. def f(n: Int) = (1 to n).map(i => 1.0 * n / i).sum Seems to check out experimentally too
1 reply 0 retweets 4 likes -
This is ugly but it works: https://gist.github.com/jliszka/4ea988d9854e34aa1e1263f64f15fa9c … It just does it by counting. It involves an infinite series that converges pretty quickly, so you can cut it off to get your desired level of accuracy.
1 reply 0 retweets 3 likes -
oh neat, thanks!
9:43 AM - 30 Nov 2018
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.