%I
%S 4,30,180,1078,6468,38808,232845,1397067,8382394,50294353,301766110,
%T 1810596649,10863579883,65181479283,391088875684,2346533254087,
%U 14079199524505,84475197147008,506851182882025,3041107097292125,18246642583752723,109479855502516309,656879133015097824
%N Number of throws of a fair die to reach a probability of at least 0.5 (50%) to have at least one sequence of n consecutive appearances of a predefined, fixed face.
%H Newsgroup article <a href="http://mathforum.org/kb/thread.jspa?threadID=1343074&tstart=75">Probabilityquestion</a> of sci.math, Mar 6 2006.
%F For m throws, the number of outcomes without n consecutive appearances of a fixed face equals the coefficient of x^(m+1) in (1x)/(16x+5x^(n+1))/5.  _Max Alekseyev_, Mar 13 2009
%e Example a(n=1)=4: after first throw, probability of the fixed face k is 1/6, 5/6 against. After 2nd throw, probability of face k not shown before but at the 2nd throw is (5/6)*(1/6). After 3rd throw, probability of face k only at this throw is (5/6)^2*(1/6), but total probability 1/6+(5/6)*(1/6)+(5/6)^2*(1/6) still less than 0.5. After the 4th throw, total probability is 1/6+(5/6)*(1/6)+(5/6)^2*(1/6)+(5/6)^3*(1/6) > 0.5.
%p with(linalg) : # Markov state approach with probability transition matrix trans # and n+1 different states for n from 1 to 30 do trans := array(1..n+1,1..n+1) : for co from 1 to n do trans[1,co] := 5/6 ; for ro from 2 to n +1 do trans[ro,co] := 0 ; od ; trans[co+1,co] := 1/6 : od: # initial state: a previous 4series for ro from 1 to n do trans[ro,n+1] := 0 : od : trans[n+1,n+1] := 1 : istate := vector(n+1) : istate[1] := 1 : for ro from 2 to n+1 do istate[ro] := 0 : od : #throw die with initial state vector istate for thro from 1 do istate := multiply(trans,istate) : if ( istate[n+1] > 1/2 ) then print(n,thro) ; break ; fi ; od : od:
%o (PARI) { a(n) = local(M,v,L); M=matrix(n+1,n+1,i,j, if(i==1&&j<=n,5/6.,if(i==j+1,1/6.,if(i==j&&i==n+1,1.,0))) ); v=vector(n+1,j,j==1)~; L=[1,2]; while((M^L[2]*v)[n+1]<0.5, L*=2; ); while(L[2]L[1]>1, m=(L[1]+L[2])\2; if((M^m*v)[n+1]<0.5,L[1]=m,L[2]=m); ); L[2] } /* _Max Alekseyev_, Mar 13 2009 */
%K nonn
%O 1,1
%A _R. J. Mathar_, Mar 14 2006
%E Extended by _Max Alekseyev_, Mar 13 2009
