A standard sixsided die is to be rolled repeatedly until a side appears a number of times equal to its number. In other words until the nth n appears.
Let P(n)=the probability the game terminates with the nth n.
Find the distribution of n.
Feel free to generalize for m sides.
Warning: I have not managed this past m=4.
(In reply to
re: computer aided solution by Jer)
With a 2sided die, of course it's
1 0.7500000000000 3/4
2 0.2500000000000 1/4
which took VB 5 just 15 ms.
With a 3sided die:
1 0.7037037037037 19/27
2 0.2222222222222 2/9
3 0.0740740740741 2/27
and again just 15 ms.
A 4sided die:
1 0.6921386718750 2835/4096
2 0.2150878906250 881/4096
3 0.0700683593750 287/4096
4 0.0227050781250 93/4096
(16 ms)
5sided die:
1 0.6890106880000 1345724/1953125
2 0.2130877440001 416187/1953125
3 0.0689024000000 5383/78125
4 0.0220866560000 43138/1953125
5 0.0069125120000 13501/1953125
(47 ms)
And again the 6sided die:
1 0.6881516453401 8987738063/13060694016
2 0.2125194475337 925217159/4353564672
3 0.0685578584217 895413211/13060694016
4 0.0218963008044 285980885/13060694016
5 0.0068166367662 9892223/1451188224
6 0.0020581121476 26880373/13060694016
(explodes to 140 full seconds, 4 seconds faster than the original hardcoded 6)
For a number of sides greater than 6, there are two problems:
1. The time will probably explode again.
2. The version of Visual Basic I use (5.0) has long integers that can go up to only 2 meg (just over 2 million) in value. I understand that later versions of VB have 8byte long integers, but I don't have any later version. The current program gets around this, for the exact values, by using double precision floating point rounded to integer values; but a 7sided die would require, for exact values, integers up to 7^22 (a 19digit number) as the procedure could take up to 22 rolls to come up with a resolution, and double precision floating point has only about 16 decimal digits of accuracy. And running it in interpreted UBASIC would take "crazy long" time.

Posted by Charlie
on 20150702 09:09:49 