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.

Showing 1-6 of 6 results.

A033138 a(n) = floor(2^(n+2)/7).

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

Comments

Previous name was: "Base 2 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,0".
Here we let p = 3 to produce the above sequence, but p can be an arbitrary natural number. By letting p = 2, 4, 6, 7 we produce A000975, A083593, A195904 and A117302. We denote by U[p,n,m] the number of cases in which the first player in a game of Russian roulette gets killed 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}. 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 (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 (p+1)st chamber and the rest of the bullets are in {p+2,..,n}. We have binomial(n-p-1,m-1) cases for this. We continue to calculate and the last is (t), where t = floor((n-m)/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(n-pt-1,m-1) cases for this.
Therefore U[p,n,m] = Sum_{z=0..t} binomial(n-pz-1,m-1), where t = floor((n-m)/p). 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 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
Partial sums of A077947. - Mircea Merca, Dec 28 2010
a(n+1) is the number of partitions of n into two kinds of part 1 and one kind of part 2. - Joerg Arndt, Mar 10 2015
A078010(n) = b(n+1) - 2*b(n) + b(n-1) where b=A078010. - Michael Somos, Nov 18 2020

Crossrefs

Programs

  • Magma
    [Round((4*2^n-2)/7): n in [1..40]]; // Vincenzo Librandi, Jun 25 2011
    
  • Maple
    seq(iquo(2^n,7),n=3..34); # Zerinvary Lajos, Apr 20 2008
  • 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 = 3 to produce the above sequence, but this code can produce A000975, A083593, A195904, A117302 for p = 2,4,6,7. *) Table[A[3,n,1], {n,1,20}] (* Ryohei Miyadera, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006 *)
  • PARI
    a(n)=2^(n+2)\7 \\ Charles R Greathouse IV, Oct 07 2015

Formula

a(n) = 2*a(n-1) + a(n-3) - 2*a(n-4). -John W. Layman
G.f.: 1/((1-x^3)*(1-2*x)); a(n) = sum{k=0..floor(n/3), 2^(n-3*k)}; a(n) = Sum_{k=0..n} 2^k*( cos(2*Pi*(n-k)/3 + Pi/3)/3 + sqrt(3)*sin(2*Pi*(n-k)/3 + Pi/3)/3 + 1/3 ). - Paul Barry, Apr 16 2005
a(n) = floor(2^(n+2)/7). - Gary Detlefs, Sep 06 2010
a(n) = floor((4*2^n - 1)/7) = ceiling((4*2^n - 4)/7) = round((4*2^n - 2)/7) = round((8*2^n - 5)/14); a(n) = a(n-3) + 2^(n-1), n>3. - Mircea Merca, Dec 28 2010
a(n) = 4/7*2^n - 5/21*cos(2/3*Pi*n) + 1/21*3^(1/2)*sin(2/3*Pi*n)-1/3. - Leonid Bedratyuk, May 13 2012

Extensions

Edited by Jeremy Gardiner, Oct 08 2011
New name (using formula form Gary Detlefs) from Joerg Arndt, Mar 10 2015

A083593 Expansion of 1/((1-2*x)*(1-x^4)).

Original entry on oeis.org

1, 2, 4, 8, 17, 34, 68, 136, 273, 546, 1092, 2184, 4369, 8738, 17476, 34952, 69905, 139810, 279620, 559240, 1118481, 2236962, 4473924, 8947848, 17895697, 35791394, 71582788, 143165576, 286331153, 572662306, 1145324612, 2290649224
Offset: 0

Views

Author

Paul Barry, May 02 2003

Keywords

Comments

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}.
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 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 (p+1)th chamber and the rest of the bullets are in {p+2,...,n}. We have binomial(n-p-1,m-1) cases for this. We continue to calculate and the last is (t), where t = floor((n-m)/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(n-pt-1,m-1) cases for this. Therefore U[p,n,m] = Sum_{z=0..floor((n-m)/p)} binomial(n-pz-1,m-1). 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
A001045(n+5) without last digit. - Paul Curtz, Apr 21 2021
a(n) is the number of partitions of n into parts 1 and 4 where there are two colors of part 1 and the order of the colors of parts 1 matters. If the order of colors doesn't matter we get A001972. - Joerg Arndt, Jan 18 2024

Crossrefs

Programs

  • 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 = 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 *)
    CoefficientList[Series[1/((1-2x)(1-x^4)),{x,0,40}],x] (* Vincenzo Librandi, Apr 04 2012 *)
    a[n_] := FromDigits[Table[(Mod[j, 4]/4) // Round, {j, 1, n + 3}], 2] (* Andres Cicuttin, Mar 25 2016 *)
    a[n_] := a[n] = 2 a[n - 1] + 1 - Ceiling[Mod[n, 4]/4]; a[0] = 1;
    Table[a[n], {n, 0, 31}] (* Andres Cicuttin, Mar 27 2016 *)
    LinearRecurrence[{2,0,0,1,-2},{1,2,4,8,17},40] (* Harvey P. Dale, Apr 03 2018 *)
  • PARI
    Vec(1/((1-2*x)*(1-x^4))+O(x^99)) \\ Charles R Greathouse IV, May 15 2013
    
  • PARI
    a(n)=(16<Charles R Greathouse IV, Mar 27 2016
    
  • Python
    def A083593(n): return ((32<Chai Wah Wu, Apr 25 2025

Formula

a(n) = 2*a(n-1) + a(n-4) - 2*a(n-5).
If n is a multiple of 4, then a(n) = 2*a(n-1) + 1, otherwise a(n) = 2*a(n-1). - Gerald McGarvey, Oct 14 2008
a(n) = floor((2^(n+5) + 1)/30). - Tani Akinari, Jul 09 2013
From Andres Cicuttin, Mar 29 2016: (Start)
a(n) = 2*a(n-1) + floor(((n-1) mod 4)/3), with a(0)=1.
a(n) = 2*a(n-1) + 1 - ceiling((n mod 4)/4), with a(0)=1. (End)
15*a(n) = 2^(n+4) - A133145(n). - R. J. Mathar, Feb 27 2019
E.g.f.: (3*cos(x) - 5*cosh(x) + 32*cosh(2*x) + 6*sin(x) - 10*sinh(x) + 32*sinh(2*x))/30. - Stefano Spezia, Apr 25 2025

A195904 Base-2 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,0,0,0,0.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 65, 130, 260, 520, 1040, 2080, 4161, 8322, 16644, 33288, 66576, 133152, 266305, 532610, 1065220, 2130440, 4260880, 8521760, 17043521, 34087042, 68174084, 136348168, 272696336, 545392672, 1090785345, 2181570690, 4363141380, 8726282760
Offset: 1

Views

Author

Jeremy Gardiner, Sep 25 2011

Keywords

Comments

Here we let p = 6 to produce the above sequence, but p can be an arbitrary natural number. By letting p = 2, 3, 4, 7 we produce A000975, A033138, A083593 and A117302. We denote by U(p,n,m) the number of cases in which the first player is 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}.
We are going to calculate the following (0), (1), ..., (t) separately. (0) The first player is 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 is 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(n-p-1,m-1) cases for this. We continue to calculate and the last is (t), where t = floor((n-m)/p). (t) The first is killed when one bullet is in the (pt+1)-th chamber and the remaining bullets are in {pt+2,...,n}. We have binomial(n-pt-1,m-1) cases for this. Therefore U(p,n,m) = Sum_{z=0..floor((n-m)/p)} binomial(n-pz-1,m-1). Let A(p,n) be the number of cases in which the first player is 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

Crossrefs

Programs

  • 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 = 6 to produce the above sequence, but this code can produce A000975, A033138, A083593, A117302 for p = 2, 3, 4, 7. *) Table[A[6, n, 1], {n, 1, 20}] (* Ryohei Miyadera, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006 *)
    Rest[CoefficientList[Series[x/(2*x^7 - x^6 - 2*x + 1), {x, 0, 50}], x]] (* G. C. Greubel, Sep 28 2017 *)
  • PARI
    x='x+O('x^50); Vec(x/(2*x^7 - x^6 - 2*x + 1)) \\ G. C. Greubel, Sep 28 2017

Formula

From Colin Barker, Jun 09 2013: (Start)
a(n) = floor(2^(n+5)/63).
G.f.: x /(2*x^7 - x^6 - 2*x +1).
G.f.: x /((x-1)*(x+1)*(2*x-1)*(x^2-x+1)*( x^2+x+1)). (End)

Extensions

More terms from Colin Barker, Jun 09 2013

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)

A178460 Partial sums of floor(2^n/127).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 31, 63, 127, 256, 514, 1030, 2062, 4126, 8254, 16510, 33023, 66049, 132101, 264205, 528413, 1056829, 2113661, 4227326, 8454656, 16909316, 33818636, 67637276
Offset: 1

Views

Author

Mircea Merca, Dec 22 2010

Keywords

Comments

Partials sums of A117302.

Examples

			a(10) = a(3) + 2^4 - 1 = 15.
		

Crossrefs

Cf. A117302.

Programs

  • Magma
    [Round((14*2^n-127*n+75)/889): n in [1..40]]; // Vincenzo Librandi, Jun 21 2011
  • Maple
    A178460 := proc(n) add( floor(2^i/127),i=0..n) ; end proc:

Formula

a(n) = round((14*2^n - 127*n + 75)/889).
a(n) = floor((14*2^n - 127*n + 284)/889).
a(n) = ceiling((14*2^n - 127*n - 134)/889).
a(n) = round((14*2^n - 127*n - 14)/889).
a(n) = a(n-7) + 2^(n-6) - 1, n > 6.
a(n) = 3*a(n-1) - 2*a(n-2) + a(n-7) - 3*a(n-8) + 2*a(n-9), n > 9.
G.f.: -x^7/((2*x-1)*(x-1)^2*(x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)).
From Seiichi Manyama, Dec 22 2023: (Start)
a(n) = Sum_{k=0..n} 2^(n-k) * floor(k/7).
a(n) = floor(2^(n+1)/127) - floor((n+1)/7). (End)

A370455 a(n) = greatest m such that 2^m divides prime(n+1)*prime(n+2) - prime(n)*prime(n+3).

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 3, 1, 4, 1, 3, 3, 3, 1, 2, 4, 1, 4, 1, 1, 2, 2, 1, 1, 3, 2, 3, 3, 3, 2, 1, 2, 3, 2, 2, 1, 2, 1, 2, 2, 3, 1, 2, 4, 1, 3, 1, 3, 7, 1, 2, 2, 2, 3, 2, 4, 1, 3, 1, 2, 1, 3, 3, 3, 1, 2, 2, 1, 5, 2, 2, 1, 1, 2, 2, 1, 5, 1, 1, 3, 3, 2, 1, 2, 2, 1
Offset: 1

Views

Author

Clark Kimberling, Feb 26 2024

Keywords

Examples

			prime(4)*prime(5) - prime(3)*prime(6) = 7*11 - 5*13 = 12, which is divisible by 2^2 but not 2^3, so a(3) = 2.
		

Crossrefs

Programs

  • Mathematica
    p[n_] := Prime[n];
    u = Table[p[n + 1] p[n + 2] - p[n] p[n + 3], {n, 1, 2000}];  (* A117302 *)
    s[n_] := Last[Select[Range[15], IntegerQ[u[[n]]/2^#] &]];
    Table[s[n], {n, 1, 200}]
  • PARI
    a(n) = valuation(prime(n+1)*prime(n+2) - prime(n)*prime(n+3), 2); \\ Michel Marcus, Mar 01 2024
    
  • Python
    from sympy import prime
    def A370455(n): return (~(m:=prime(n+1)*prime(n+2)-prime(n)*prime(n+3)) & m-1).bit_length() # Chai Wah Wu, Mar 02 2024
Showing 1-6 of 6 results.