Our friend Mac likes to eat ice-cream so much that he started to work in an ice-cream parlor. Satisfied by his work, the ice-cream owner gave him 10 different kind of ice-cream each 2 in quantity(20 ice-creams in total). Mac have gone crazy so much that he brought a fair 10 sided dice and devised the following ice-cream eating algorithm : -
Label the 20 ice-creams with number 1 to 10 based on the type of ice-cream.
Roll the 10 sided dice. Let the number obtained be n.
If there is any ice-cream of type n remaining, eat it. Else do nothing.
If the ice-cream lot is not finished, repeat the above steps from step 2.
What is the expected number of dice rolls he will have to do to finish eating his ice-creams?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Amazing simulation @Kyle Tripp. If one wants a solution using a computer program, recursion could also be used to do so.
let f ( a , b ) be the expected number of dice rolls required to finish ice-cream such that there are 'a' type of ice-creams with only one quantity left each and 'b' type of ice-creams with two quantities left each then the following equation follows:- f ( a , b ) = 1 0 b ( 1 + f ( a + 1 , b − 1 ) ) + 1 0 a ( 1 + f ( a − 1 , b ) ) + 1 0 1 0 − a − b ( 1 + f ( a , b ) ) we get the recursion below:- 1 0 a + b f ( a , b ) = 1 0 b f ( a + 1 , b − 1 ) + 1 0 a f ( a − 1 , b ) + 1 which could be solved efficiently using dynamic programming. Let me know if this is right
Log in to reply
This is a nice idea. Have you managed to get it to work? You need a bit more than you've written here to actually get an answer out. I'm not sure of the best way to describe this, but I'll try! The relation you've written down allows you to write f ( a , b in terms of f ( a + 1 , b − 1 ) and f ( a − 1 , b ) .
If you imagine the a , b values as lattice points on a plane, the relation you found gives you a way to move around the plane. The idea is to start at ( a , b ) = ( 0 , 1 0 ) (the problem setup) and move around the plane until we end up somewhere we can actually evaluate f . Then we can work out f ( 0 , 1 0 ) from there.
So for this to work, you need to know a little more about f .
One thing that helps is that it's easy to find f ( a , 0 ) : this is the simpler problem where you only need each value to come up once, and it has the solution f ( a , 0 ) = 1 0 ∑ i = a 1 0 i 1 (by the way, this is known as the coupon collector's problem .
So if we can "steer" the point ( a , b ) towards the line b = 0 , we can solve the problem.
The difficulty is, the b parameter only reduces in one term of the relation you found. Without some other relationship or known f values, I'm not sure it's possible to steer things exactly as we'd like.
Anyway, please post a solution or a follow-up comment if you get somewhere this way!
Log in to reply
That is true. We need a base case to begin with, of which most helpful would be f(1,0)=10 (solved by constructing a gp series). We can choose f(1,0) to be base case since every f(a,b) could be reduced to some expression in f(1,0) following a series of recursion. Following code follows the recursion and completes the work.
1 2 3 4 5 6 7 8 |
|
Log in to reply
@Mayank Chaturvedi – That's awesome, well done! You should write this up as a solution. It's great that there are (so far) three different approaches listed here! (Simulation, recursion and - via a link - a general, analytical method.) I think I like yours best as it gets an exact solution (if you wanted to, you could use fractions in your method), but doesn't do too much.
Thanks for the fun problem, by the way.
Log in to reply
@Chris Lewis – Thank you Chris glad you found the problem interesting. I will post the solution soon.
This is the Double Dixie Cup problem .
Using the notation of the linked paper, the expected number of dice rolls is
E 2 ( 1 0 ) = 1 0 ∫ 0 ∞ [ 1 − ( 1 − ( 1 + t ) e − t ) 1 0 ] d t
The integrand can be expanded using the Binomial theorem and integrated termwise. Doing this by hand would be somewhat tedious; lots of integration by parts, though doing this exercise for smaller n at least shows we expect a rational result. Enlisting the help of Wolfram|Alpha, we find
E 2 ( 1 0 ) = 7 2 6 0 3 2 9 1 1 4 1 1 2 6 1 4 4 0 0 0 0 0 0 0 0 3 3 5 6 4 1 8 9 7 6 4 6 5 1 1 2 1 6 6 6 8 1 6 3 0 8 3 = 4 6 . 2 2 9 5 7 …
Problem Loading...
Note Loading...
Set Loading...
not necessarily a solution, but an approximation