Spongebob loves square numbers. So, he decides to keep rolling a fair six-sided die, until any consecutive substring represent(s) a perfect square less than 100. e.g. If his last two rolls were first a 2 and then a 5, he would be done since 25 is a perfect square. Or, for example, any time he rolls a 4 he would also be done since 4 is a square number.
If the expected number of rolls he must make is , where and are coprime positive integers , what is ?
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.
Relevant wiki: Expected Value - Problem Solving
Let E n = The expected number of remaining rolls given that n was the last number rolled.
Since 1 and 4 are both square, clearly E 1 = E 4 = 0 .
Also, the only two digit squares (consisting of the numbers 1 ... 6 ) are 2 5 , 3 6 , and 6 4 . But, 6 4 doesn't "buy you anything new" since 4 is also a square, so rolling a 6 is essentially like starting over. So, E 6 = E 0 . Translating these into a set of linear equations:
The above equations are derived by considering states 0 , 2 , and 3 labeled by what the last number you rolled is (except for 0 which is the state you start in). So, E n = The expected number of rolls from state n . Then you can derive the above equations, for example for E 2 , from state 2 you use up 1 roll (the first term, 1 ) and you have 1 / 6 probability of getting to 0 , 2 or 3 . This translates to the second equation in the solution. You set up similar equations for 0 , 4 and 6 .
Solving for E 0 , you get, E 0 = 1 8 / 7
1 8 + 7 = 2 5