In
"5 dice" Andy had five regular dice. Now he has a total of N regular dice. He claims that the odds of rolling exactly M sixes is exactly half as likely as rolling (M-1) sixes. (M < N).
For what values of N is this true?
State the pattern if there is one.
Express M as a function of N.
N=7k-1 where k is a positive integer. And M=2k using the same k, so M=2(N+1)/7.
The program output shows N, M-1, M, p(M-1), p(M) and the ratio of the two probabilities.
6 1 2 0.401877572016 0.200938786009 1.99999999999
13 3 4 0.213845355123 0.106922677562 1.999999999991
20 5 6 0.12941029198 0.06470514599 2
27 7 8 0.082745419868 0.041372709934 2
34 9 10 0.054558633927 0.027279316963 2.000000000037
41 11 12 0.036686982814 0.018343491407 2
48 13 14 0.025008402857 0.012504201428 2.00000000008
from
p1=1/6
p2=5/6
Open 2,"n dice.txt","w"
for n=3 to 50
for x=1 to n
p=prob
prob=comb(n,x)*p1^x*p2^(n-x)
if prob<>0 then
if abs(p/prob-2) <.00000001 then
Print n,x-1,x,p,prob,p/prob
o$=str$(n)+" "+str$(x-1)+" "+str$(x)+" "+str$(p)+" "+str$(prob)+" "+str$(p/prob)
writeln 2,o$
Endif
endif
next
next
Close 2
end
sub fact(x)
f=1
For i=2 to x
f=f*i
Next
return(f)
end sub
sub comb(n,r)
c=fact(n)/(fact(r)*fact(n-r))
Return c
End Sub
|
Posted by Charlie
on 2017-05-25 12:14:14 |