%I
%S 1,2,4,8,17,34,68,136,273,546,1092,2184,4369,8738,17476,34952,69905,
%T 139810,279620,559240,1118481,2236962,4473924,8947848,17895697,
%U 35791394,71582788,143165576,286331153,572662306,1145324612,2290649224
%N Expansion of 1/((12*x)*(1x^4)).
%C Here we let p = 4 to produce the above sequence, but p can be an arbitrary natural number. By letting p = 2, 3, 6, 7 we produce A000975, A033138, A195904 and A117302. We denote by U[p,n,m] the number of cases in which the first player gets killed in a Russian roulette game when p players use a gun with n chambers and m bullets. They never rotate the cylinder after the game starts. The chambers can be represented by the list {1,2,...,n}.
%C We are going to calculate the following (0), (1), ..., (t) separately. (0) The first player gets killed when one bullet is in the first chamber and the remaining m1 bullets are in {2,3,...,n}. We have binomial(n1,m1) cases for this. (1) The first gets killed when one bullet is in the (p+1)th chamber and the rest of the bullets are in {p+2,...,n}. We have binomial(np1,m1) cases for this. We continue to calculate and the last is (t), where t = floor((nm)/p). (t) The first gets killed when one bullet is in the (pt+1)st chamber and the remaining bullets are in {pt+2,...,n}. We have binomial(npt1,m1) cases for this. Therefore U[p,n,m] = Sum_{z=0..floor((nm)/p)} binomial(npz1,m1). Let A[p,n] be the number of the cases in which the first player gets killed when p players use a gun with n chambers and the number of the bullets can be from 1 to n. Then A[p,n] = Sum_{m=1..n} U[p,n,m].  _Ryohei Miyadera_, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006
%H Vincenzo Librandi, <a href="/A083593/b083593.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,0,1,2).
%F a(n) = 2*a(n1) + a(n4)  2*a(n5).
%F a(n) = 1/4 + (1/20  i/10)*i^n + (1/12)*(1)^n + (16/15)*2^n + (1/20 + i/10)*(i)^n, for n >= 0, where i=sqrt(1).  _Paolo P. Lava_, Jun 10 2008
%F If n is a multiple of 4, then a(n) = 2*a(n1) + 1, otherwise a(n) = 2*a(n1).  _Gerald McGarvey_, Oct 14 2008
%F a(n) = floor((2^(n+5) + 1)/30).  _Tani Akinari_, Jul 09 2013
%F a(n) = 2*a(n1) + floor(((n1) mod 4) /3), with a(0)=1.  _Andres Cicuttin_, Mar 29 2016
%F a(n) = 2*a(n1) + 1  ceiling((n mod 4)/4), with a(0)=1.  _Andres Cicuttin_, Mar 29 2016
%F 15*a(n) = 2^(n+4)  A133145(n).  _R. J. Mathar_, Feb 27 2019
%t U[p_,n_,m_,v_]:=Block[{t},t=Floor[(1+pm+nv)/p];Sum[Binomial[nvp*z,m1],{z,0,t1}]]; A[p_,n_,v_]:=Sum[U[p,n,k,v],{k,1,n}]; (* Here we let p = 4 to produce the above sequence, but this code can produce A000975, A033138, A195904, A117302 for p=2,3,6,7.*) Table[A[4,n,1], {n,1,20}] (* _Ryohei Miyadera_, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006 *)
%t CoefficientList[Series[1/((12x)(1x^4)),{x,0,40}],x] (* _Vincenzo Librandi_, Apr 04 2012 *)
%t a[n_] := FromDigits[Table[(Mod[j, 4]/4) // Round, {j, 1, n + 3}], 2] (* _Andres Cicuttin_, Mar 25 2016 *)
%t a[n_] := a[n] = 2 a[n  1] + 1  Ceiling[Mod[n, 4]/4]; a[0] = 1;
%t Table[a[n], {n, 0, 31}] (* _Andres Cicuttin_, Mar 27 2016 *)
%t LinearRecurrence[{2,0,0,1,2},{1,2,4,8,17},40] (* _Harvey P. Dale_, Apr 03 2018 *)
%o (PARI) Vec(1/((12*x)*(1x^4))+O(x^99)) \\ _Charles R Greathouse IV_, May 15 2013
%o (PARI) a(n)=(16<<n)\15 \\ _Charles R Greathouse IV_, Mar 27 2016
%Y Cf. A033138, A000975, A033138, A195904, A117302.
%K easy,nonn
%O 0,2
%A _Paul Barry_, May 02 2003
