All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Expected Number of Tosses (Posted on 2025-01-28) Difficulty: 3 of 5
Mac is idly tossing two dice when he decides to see how many tosses it would take to go from 1 to 6 in order. The rules are to toss the two dice until one or the other or both show a 1. Then, toss until a 2 shows. However, if both a 1 and a 2 show at the same time, both can be used.

He then tosses for a 3 and similarly for other numbers. What is the expected number of tosses to go from 1 to 6?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts failed analytic attempt; switch to simulation | Comment 1 of 4
My attempt at an analytic solution did not work out, but perhaps someone can see the flaw(s) in my reasoning and make the appropriate corrections. Otherwise you can skip ahead to the simulation results further down.


On a given toss, the probability that one or two of a given number appears is 2/6 - 1/36 = 11/36, so the expected number of tosses to get that outcome is 36/11.

Each number in turn will have this expected wait, so the expected number of tosses to complete the set in order is 6*36/11 = 216/11 =~ 19.6363636363636.

But wait, if the second number up next is achieved at the time of the first, then that second number has no wait time. The probability is 2/36 = 1/18 that two numbers will be achieved in one roll. In that case the next number after that still has to be obtained the ordinary way.  The first time through also has to be done the ordinary way.

The possible ways go from

1  2  3  4  5  6

through

12  34  56

including such sequences as

1 2 3 45 6

Let's start with the likelihood during a sequence of tosses that only the single sought number will be achieved vs both that number and the next will be achieved. The overall probability the next number will come up is 11/36 as mentioned previously; the probability that both show up is 1/18. Out of the 11/36, 9/36 is that only the one shows up and 2/36 both do. Overall, the probability that it is the double hit that is the one to achieve is 2/11 with 9/11 the probability that only the one next number is achieved.

1 2 3 4 5 6 (i.e., only individuals are found) has probability 

(9/11)^5 =~ 0.366647832053201 

of being the case so this is the fractional contribution of the original calculation above holding, so the first contribution to (term in) the expected length is (216/11) * (9/11)^5 =~ 7.19963015668103.

12 3 4 5 6
1 23 4 5 6
1 2 34 5 6
1 2 3 45 6

all have equal terms in the expected value of the number of tosses:

(9/11)^3 * (2/11) * (4*36/11 + 18)

The total of the four possibilities is four times this, or about

11.0809122576078

to be added to the expected value.

This is already getting too large. It threatens to exceed the expected number when not even allowing shortcuts to the next number. I suspect the addition of the full 18 for the single double finding, as this should be the conditional expectation given that the double finding (next and next after that) is the first successful finding of the current goal. But calculating that would be a problem, except if the 18 were merely another 36/11; we're only awaiting one digit but by happenstance, whose probability has already been factored in, it's accompanied by the secondary goal.

If we use

(9/11)^3 * (2/11) * (5*36/11)

and multiply by 4 we're talking about an addition of 

6.51818368094579

to the expected value.

In fact we can include all cases where exactly one occurence of moving the total by 2 happens:

(9/11)^4 * (2/11) * (5*36/11),
this time multiplied by 5:

((9/11)^4 * (2/11) * (5*36/11)) * 5 = 6.6663242191491


I was going to continue in this vein, but when I started to create a table of the probabilities and the respective expected number of rolls, I started with these columns:


No. of  prob of occurrence
double
 finds
   0    (9/11)^5
   1    (9/11)^3 * (2/11) * 5
   2    (9/11) * (2/11)^2 * 3
   3    (2/11)^2

and found these probabilities add up to only about 95%, so something is wrong.


That prompted me to go the way of a simulation:

clearvars
ct=zeros(1,3);
totTosses=zeros(1,3);
noDoubleCt=0;
noDoubleTosses=0;
for trial=1:1000000
  goingFor=1; took=0; double=0;
  while goingFor<7
    r1=randi(6);
    r2=randi(6);
    took=took+1;
    combo=[r1 r2];
    if ismember(goingFor,combo)
      if ismember(goingFor+1,combo)
        goingFor=goingFor+2;        
        if goingFor<8
          double=double+1;
        end
      else
        goingFor=goingFor+1;
      end
    end
  end
  if double>0
    ct(double)=ct(double)+1;
    totTosses(double)=totTosses(double)+took;
  else
    noDoubleCt=noDoubleCt+1;
    noDoubleTosses=noDoubleTosses+took;
  end
end
fprintf('%2d %7d %10.3f %10.3f \n',0,noDoubleCt,noDoubleCt/trial,noDoubleTosses/noDoubleCt);
for i=1:3
  fprintf('%2d %7d %10.3f %10.3f \n',i,ct(i),ct(i)/trial,totTosses(i)/ct(i));
end
% disp([noDoubleCt ct])
% disp([noDoubleTosses/noDoubleCt totTosses./ct])
avg=(noDoubleTosses+sum(totTosses))/(noDoubleCt+sum(ct))


>> expectedNumberOfTosses

number of times      occurrences   fraction    average
two numbers were     in 1 million   of the  expectation
found in one toss      trials       cases   for when this
                                              happens
 0                     366643       0.367      19.626 
 1                     479558       0.480      16.363 
 2                     147719       0.148      13.069 
 3                       6080       0.006       9.819 
avg =
                 17.033124
                 
The latter average, 17.0 is the weighted average based on the frequencies of the double-finding tosses.

Note that the 19.626 for zero double finds statistically matches the first analytic finding and the mismatches arise from the second-next complication.


Modifying the program to do 100 million trials gives

 0                 36668381      0.367     19.638 
 1                 47978975      0.480     16.364 
 2                 14750202      0.148     13.092 
 3                   602442      0.006      9.823 
avg =
               17.04223813
               
The 100 million trials took 15 minutes to run.  I have a 600-million-trial run going now, which presumably will be finished in about an hour and a half.               


  Posted by Charlie on 2025-01-28 09:57:52
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information