cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Previous Showing 11-13 of 13 results.

A119610 Number of cases in which the first player is killed in a Russian roulette game where 5 players use a gun with n chambers and the number of bullets can be from 1 to n. Players do not rotate the cylinder after the game starts.

Original entry on oeis.org

1, 2, 4, 8, 16, 33, 66, 132, 264, 528, 1057, 2114, 4228, 8456, 16912, 33825, 67650, 135300, 270600, 541200, 1082401, 2164802, 4329604, 8659208, 17318416, 34636833, 69273666, 138547332, 277094664, 554189328, 1108378657, 2216757314
Offset: 1

Views

Author

Ryohei Miyadera, Jun 04 2006

Keywords

Comments

Denote by U(p,n,m) the number of the cases in which the first player is killed in a Russian roulette game where 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}.
Here we let p = 5 to produce the above sequence, but p can be an arbitrary positive integer. By letting p = 2, 3, 4, 6, 7 we can produce sequences A000975, A033138, A083593, A195904 and A117302, respectively.
The number of cases for each of the situations identified below by (0), (1), ..., (t), where t = floor((n-m)/p), can be calculated separately:
(0) The first player is killed when one bullet is in the first chamber and the remaining m-1 bullets are in chambers {2,3,...,n}. There are binomial(n-1,m-1) cases for this situation.
(1) The first player is killed when one bullet is in the (p+1)-th chamber and the rest of the bullets are in chambers {p+2,...,n}. There are binomial(n-p-1,m-1) cases for this situation.
...
(t) The first player is killed when one bullet is in the (p*t+1)-th chamber and the remaining bullets are in chambers {p*t+2,...,n}. There are binomial(n-p*t-1,m-1) cases for this situation.
Therefore U(p,n,m) = Sum_{z=0..t} binomial(n-p*z-1,m-1), where t = floor((n-m)/p). Let A(p,n) be the number of the cases in which the first player is killed when p players use a gun with n chambers and the number of bullets can be from 1 to n. Then A(p,n) = Sum_{m=1..n} U(p,n,m).

Examples

			If the number of chambers is 3, then the number of the bullets can be 1, 2, or 3. The first player is killed when one bullet is in the first chamber, and the remaining bullets are in the second and third chambers. The only cases are {{1, 0, 0}, {1, 1, 0}, {1, 0, 1}, {1, 1, 1}}, where we denote by 1 a chamber that contains a bullet. Therefore a(3) = 4.
		

Crossrefs

Partial sums of A349842.

Programs

  • Magma
    I:=[1,2,4,8,16,33]; [n le 6 select I[n] else 2*Self(n-1)+Self(n-5)-2*Self(n-6): n in [1..40]]; // Vincenzo Librandi, Mar 18 2015
    
  • Maple
    seq(floor(2^(n+4)/31), n = 1..32); # Mircea Merca, Dec 22 2010
  • Mathematica
    U[p_,n_,m_,v_]:=Block[{t},t=Floor[(1+p-m+n-v)/p]; Sum[Binomial[n-v-p*z,m-1], {z,0,t-1}]];
    A[p_,n_,v_]:=Sum[U[p,n,k,v],{k,1,n}];
    (* Here we let p = 5 to produce the above sequence, but this code can produce A000975, A033138, A083593, A195904, A117302 for p = 2, 3, 4, 6, 7. *)
    Table[B[5,n,1],{n,1,20}] (* end of program *)
    CoefficientList[ Series[ 1/(2x^6 - x^5 - 2x + 1), {x, 0, 32}], x] (* or *)
    LinearRecurrence[{2, 0, 0, 0, 1, -2}, {1, 2, 4, 8, 16, 33}, 32] (* Robert G. Wilson v, Mar 12 2015 *)
  • PARI
    for(n=1,50, print1(floor(2^(n+4)/31), ", ")) \\ G. C. Greubel, Oct 11 2017

Formula

a(n) = floor(2^(n+4)/31), which is obtained by letting p=5 in a_p(n) = (2^(n + p-1) - 2^((n-1) mod p))/(2^p - 1).
From Joerg Arndt, Jan 08 2011: (Start)
G.f.: x / ( (x-1)*(2*x-1)*(x^4+x^3+x^2+x+1) ).
a(n) = +2*a(n-1) +a(n-5) -2*a(n-6). (End)

A155803 A023001 interleaved with 2*A023001 and 4*A023001.

Original entry on oeis.org

0, 0, 0, 1, 2, 4, 9, 18, 36, 73, 146, 292, 585, 1170, 2340, 4681, 9362, 18724, 37449, 74898, 149796, 299593, 599186, 1198372, 2396745, 4793490, 9586980, 19173961, 38347922, 76695844, 153391689, 306783378, 613566756, 1227133513, 2454267026, 4908534052
Offset: 0

Views

Author

Paul Curtz, Jan 27 2009

Keywords

Comments

A033138 with three zeros prepended. - Joerg Arndt, Mar 10 2015

Programs

Formula

a(3n) = A023001(n). a(3n+1) = 2*A023001(n) = A125835(n). a(3n+2) = 4*A023001(n).
a(n) = a(n-3)+2^(n-3) = a(n-3)+A000079(n-3). Here, a(.) can also be one of its higher order differences.
a(n) = 2*a(n-1)+a(n-3)-2*a(n-4). G.f.: x^3/((x-1)*(2*x-1)*(1+x+x^2)). [R. J. Mathar, Jul 23 2009]
a(n) = floor(2^n/7). [Mircea Merca, Dec 22 2010]

Extensions

Edited and extended by R. J. Mathar, Jul 23 2009

A052935 Expansion of (2-2*x-x^3)/((1-2*x)*(1-x^3)).

Original entry on oeis.org

2, 2, 4, 9, 16, 32, 65, 128, 256, 513, 1024, 2048, 4097, 8192, 16384, 32769, 65536, 131072, 262145, 524288, 1048576, 2097153, 4194304, 8388608, 16777217, 33554432, 67108864, 134217729, 268435456, 536870912, 1073741825, 2147483648
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Programs

  • GAP
    a:=[2,2,4,9];; for n in [5..40] do a[n]:=2*a[n-1]+a[n-3]-2*a[n-4]; od; a; # G. C. Greubel, Oct 18 2019
  • Magma
    R:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (2-2*x-x^3)/((1-2*x)*(1-x^3)) )); // G. C. Greubel, Oct 18 2019
    
  • Maple
    spec:= [S,{S=Union(Sequence(Prod(Z,Z,Z)),Sequence(Union(Z,Z)))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20);
    seq(coeff(series((2-2*x-x^3)/((1-2*x)*(1-x^3)), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Oct 18 2019
  • Mathematica
    CoefficientList[Series[(2-2*x-x^3)/((1-2*x)*(1-x^3)), {x, 0, 40}], x] (* G. C. Greubel, Oct 05 2017 *)
    LinearRecurrence[{2,0,1,-2}, {2,2,4,9}, 40] (* G. C. Greubel, Oct 18 2019 *)
  • PARI
    my(x='x+O('x^40)); Vec((2-2*x-x^3)/((1-2*x)*(1-x^3))) \\ G. C. Greubel, Oct 05 2017
    
  • Sage
    def A052935_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P((2-2*x-x^3)/((1-2*x)*(1-x^3))).list()
    A052935_list(40) # G. C. Greubel, Oct 18 2019
    

Formula

G.f.: (2-2*x-x^3)/((1-x^3)*(1-2*x)).
a(n) = a(n-1) + a(n-2) + 2*a(n-3) - 1.
a(n) = 2^n + Sum_{alpha=RootOf(-1+z^3)} alpha^(-n)/3.
a(n) = 2*A033138(n+1) - 2*A033138(n) - A033138(n-2). - R. J. Mathar, Nov 28 2011

Extensions

More terms from James Sellers, Jun 05 2000
Previous Showing 11-13 of 13 results.