// k >= 1, the die is fair, and all rolls are independent
Andy rolls the die, let a be the result;
Sean rolls the die, let s be the result;
if a > s
then print Andy goes first;
if a < s
then print Sean goes first;
if a = s
then WhoGoesFirst(k + 1)
The algorithm WhoGoesFirst(1) is run, i.e., with k = 1. Define the random variable X to be the value of the output of this algorithm.
What is the expected value E(X) of the random variable X?
I'm not sure how to get an output from this algorithm. Wouldn't the result of rolling the die for both of them have a probability of 1/6? How can I come up with a result that says one person has a higher chance of a roll then the other? And if I assume it is the same, then the recursive function would just loop through the algorithm again. I'm struggling to come up with any output from this algorithm to use to calculate the expected value.