tag:blogger.com,1999:blog-6314876008291942531.post6229729417468935183..comments2022-05-10T19:43:47.140-07:00Comments on Antonio Gulli's coding playground: Puzzle game with diceUnknownnoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6314876008291942531.post-71724839834875132632009-10-11T22:01:07.765-07:002009-10-11T22:01:07.765-07:00There are many solutions to this one. I like the f...There are many solutions to this one. I like the following:<br /><br />1. What is the probability of seeing a number ? 1/6<br />2. On n trials, what is the probability of seeing the k-th number, provided that you have seen (k-1)th before ? there are n-(k-1) numbers to see and so the probability is p=(n-k+1)/6 <br />3. What is the average number of trial before a success? This is a classical question: \sum_i(i p (1-p)^(i-1)). It&#39;s a success after i-1 insuccess and that series converge to 1/p<br />4. Therefore we have, that for the k tentative the expectation is 6 / (n-k+1)<br />5. Since the expectation is linear<br />k=1 =&gt; 6/6<br />k=2 =&gt; 5/6<br />k=3 =&gt; 4/6<br />k=4 =&gt; 3/6<br />k=5 =&gt; 2/6<br />k=6 =&gt; 1/6<br />This last passage is very intuitive and can be given directly. The result comes from the sum of all the above fractions since expectation is linear.codingplaygroundhttps://www.blogger.com/profile/08478993186814330588noreply@blogger.com