%I #32 Sep 08 2022 08:45:24
%S 1,2,4,8,16,32,64,129,258,516,1032,2064,4128,8256,16513,33026,66052,
%T 132104,264208,528416,1056832,2113665,4227330,8454660,16909320,
%U 33818640,67637280,135274560,270549121,541098242
%N Number of cases in which the first player gets killed in a Russian roulette game when 7 players use a gun with n chambers and the number of the bullets can be from 1 to n. In the game they do not rotate the cylinder after the game starts.
%C We denote by U[7,n,m] the number of cases that the first player gets killed in a Russian roulette game when 7 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}. We are going to calculate (0), (1), ..., (t) separately. (0) The first player gets killed when one bullet is in the first chamber and the remaining (m-1) bullets are in {2,3,...,n}. We have binomial(n-1,m-1) cases for this. (1) The first gets killed when one bullet is in the 8th chamber and the rest of the bullets are in {9,..,n}. We have binomial(n-8,m-1) cases for this. We continue to calculate and the last is (t), where t = floor((n-m)/7). (t) The first gets killed when one bullet is in (7t+1)-st chamber and the remaining bullets are in {7t+2,...,n}. We have binomial(n-7t-1,m-1) cases for this. Therefore U[7,n,m] = Sum_{z=0..t} binomial(n-7z-1,m-1), where t = floor((n-m)/7). Let A[7,n] be the number of cases in which the first player gets killed when 7 players use a gun with n chambers and the number of bullets can be from 1 to n. Then A[7,n] = Sum_{m=1..n} U[7,n,m].
%D Miyadera, R. "General Theory of Russian Roulette." Mathematica source.
%D Miyadera, R. Mathematical Theory of Magic Fruits Archimedes-lab.
%H G. C. Greubel, <a href="/A117302/b117302.txt">Table of n, a(n) for n = 1..1000</a>
%H R. Miyadera, <a href="http://library.wolfram.com/infocenter/MathSource/5710/">General Theory of Russian Roulette</a>, MathSource
%H R. Miyadera, Daisuke Minematsu, Satoshi Hashiba and Munetoshi Hashiba, <a href="http://www.archimedes-lab.org/fraction_patt/Magic_fruits.html">Theory of Magic Fruits</a>, Archimedes-lab, Interesting patterns of fractions
%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,0,0,0,0,1,-2).
%F a(n) = (2^(n + 6) - 2^((n-1) mod 7))/(2^7 - 1).
%F a(n) = floor(2^(n+6)/127). - _Mircea Merca_, Dec 22 2010
%F From _Joerg Arndt_, Jan 08 2011: (Start)
%F G.f.: x/( (x-1)*(2*x-1)*(x^6 + x^5 + x^4 + x^3 + x^2 + x + 1) ).
%F a(n) = 2*a(n-1) + a(n-7) - 2*a(n-8). (End)
%e If the number of chambers is 3, then the number of the bullets can be 1,2,3. The first one get killed when one bullet is in the first chamber and the remaining bullets are in the second and the third chamber. All the cases are {{1, 0, 0}, {1, 1, 0}, {1, 0, 1}, {1, 1, 1}}, where we denote by 1 the chamber that contains the bullet. Therefore a(3) = 4.
%p A117302 := proc(n) floor(2^(n+6)/127) ; end proc:
%t U7[n_, m_]:= Block[{t}, t=Floor[(n-m)/7]; Sum[Binomial[n-1-7z, m-1], {z,0,t}]]; A7[n_]:= Sum[U7[n, m], {m,1,n}]; Table[A7[n], {n,1,40}]
%t LinearRecurrence[{2,0,0,0,0,0,1,-2}, {1,2,4,8,16,32,64,129}, 40] (* _G. C. Greubel_, May 07 2019 *)
%o (PARI) a(n)=2^(n+6)\127 \\ _Charles R Greathouse IV_, Oct 07 2015
%o (Magma) [Floor(2^(n+6)/127): n in [1..40]]; // _G. C. Greubel_, May 07 2019
%o (Sage) [floor(2^(n+6)/127) for n in (1..40)] # _G. C. Greubel_, May 07 2019
%K nonn,easy
%O 1,2
%A Tomohide Hashiba, Akihiro Hyogu, Hiroshi Matsui, _Ryohei Miyadera_, Yuta Nakagawa, Apr 24 2006
%E Edited by _G. C. Greubel_, May 07 2019