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.

A187180 Parse the infinite string 0101010101... into distinct phrases 0, 1, 01, 010, 10, ...; a(n) = length of n-th phrase.

Original entry on oeis.org

1, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15, 16, 17, 16, 17, 18, 19, 18, 19, 20, 21, 20, 21, 22, 23, 22, 23, 24, 25, 24, 25, 26, 27, 26, 27, 28, 29, 28, 29, 30, 31, 30, 31, 32, 33, 32, 33, 34, 35, 34, 35, 36, 37, 36, 37, 38, 39, 38, 39, 40, 41, 40, 41, 42, 43, 42, 43, 44, 45, 44, 45, 46, 47, 46, 47, 48, 49, 48, 49, 50, 51, 50, 51, 52, 53, 52, 53, 54, 55, 54, 55, 56, 57, 56, 57, 58, 59, 58, 59, 60, 61
Offset: 1

Views

Author

N. J. A. Sloane, Mar 06 2011

Keywords

Examples

			The sequence begins
   1   1
   2   3   2   3
   4   5   4   5
   6   7   6   7
   8   9   8   9
  10  11  10  11 ...
		

Crossrefs

See A187180-A187188 for alphabets of size 2 through 10.
Essentially the same as A106249 and A018837.

Programs

  • Maple
    1,1,seq(op(2*i*[1,1,1,1]+[0,1,0,1]), i=1..100); # Robert Israel, Oct 15 2015
  • Mathematica
    Join[{1},LinearRecurrence[{1, 0, 0, 1, -1},{1, 2, 3, 2, 3},119]] (* Ray Chandler, Aug 26 2015 *)
    CoefficientList[Series[(x^5 - 2 x^4 + x^3 + x^2 + 1)/((x - 1)^2 (x + 1) (x^2 + 1)), {x, 0, 150}], x] (* Vincenzo Librandi, Oct 16 2015 *)
  • PARI
    a(n) = if(n==1, 1, (1 + (-1)^n + (1-I)*(-I)^n + (1+I)*I^n + 2*n) / 4); \\ Colin Barker, Oct 15 2015
    
  • PARI
    Vec(x*(x^5-2*x^4+x^3+x^2+1) / ((x-1)^2*(x+1)*(x^2+1)) + O(x^100)) \\ Colin Barker, Oct 15 2015

Formula

Consider more generally the string 012...k012...k012...k012...k01... with an alphabet of size B, where k = B-1. The sequence begins with B 1's, and thereafter is quasi-periodic with period B^2, and increases by B in each period.
For the present example, where B=2, the sequence begins with two 1's and thereafter increases by 2 in each block of 4: (1,1) (2,3,2,3), (4,5,4,5), (6,7,6,7), ...
From Colin Barker, Oct 15 2015: (Start)
a(n) = (1+(-1)^n+(1-i)*(-i)^n+(1+i)*i^n+2*n)/4 for n>1, where i = sqrt(-1).
G.f.: x*(x^5-2*x^4+x^3+x^2+1) / ((x-1)^2*(x+1)*(x^2+1)). (End)
From Wesley Ivan Hurt, May 03 2021: (Start)
a(n) = a(n-1)+a(n-4)-a(n-5).
a(n) = floor((n+1+(-1)^floor((n+1)/2))/2) for n > 1. (End)

A018837 Number of steps for knight to reach (n,0) on infinite chessboard.

Original entry on oeis.org

0, 3, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15, 16, 17, 16, 17, 18, 19, 18, 19, 20, 21, 20, 21, 22, 23, 22, 23, 24, 25, 24, 25, 26, 27, 26, 27, 28, 29, 28, 29, 30, 31, 30, 31, 32, 33, 32, 33, 34, 35, 34, 35, 36, 37, 36, 37, 38, 39, 38, 39, 40, 41, 40, 41, 42, 43
Offset: 0

Views

Author

Keywords

Comments

The knight starts at (0,0) and we count the least number of steps. Row 1 of the array at A065775. - Clark Kimberling, Dec 20 2010
Apparently also the minimum number of steps of the (1,3)-leaper to reach (n,n) starting at (0,0). - R. J. Mathar, Jan 05 2018

Examples

			a(1)=3 counts these moves: (0,0) to (2,1) to (0,2) to (1,0). - _Clark Kimberling_, Dec 20 2010
		

Crossrefs

Cf. A065775, A183041-A183053, A083219 (essentially the same).
Cf. A018840 for the (2,3)-leaper.

Programs

  • Mathematica
    CoefficientList[Series[x (3 - x + x^2 - x^3 - 2 x^4 + 2 x^5)/((1-x)^2 (1+x) (1+x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Jan 06 2018 *)
    Array[Which[#==1,3,True,(#+Mod[#,4])/2]&,100,0] (* Elisha Hollander, Aug 05 2021 *)
  • PARI
    concat([0], Vec( x*(3-x+x^2-x^3-2*x^4+2*x^5)/((1-x)^2*(1+x)*(1+x^2)) + O(x^166) ) ) \\ Joerg Arndt, Sep 10 2014
    
  • Python
    def a(n): return 3 if n == 1 else (n + n % 4) // 2 # Elisha Hollander, Aug 05 2021

Formula

a(n) = 2[ (n+2)/4 ] if n even, 2[ (n+1)/4 ]+1 if n odd (n >= 8).
G.f.: x*(3-x+x^2-x^3-2*x^4+2*x^5)/((1-x)^2*(1+x)*(1+x^2)). a(n)=A083219(n), n<>1. - R. J. Mathar, Dec 15 2008
T(0,0)=0, T(1,0)=3, and for m>=1, T(4m-2,0)=2m, T(4m-1,0)=2m+1, T(4m,0)=2m, T(4m+1,0)=2m+1 where T(.,.) = A065775(.,.). - Clark Kimberling, Dec 20 2010
Sum_{n>=1} (-1)^n/a(n) = 5/3 - 2*log(2). - Amiram Eldar, Sep 10 2023

A129756 Repetitions of odd numbers four times.

Original entry on oeis.org

1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 9, 9, 9, 9, 11, 11, 11, 11, 13, 13, 13, 13, 15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21, 23, 23, 23, 23, 25, 25, 25, 25, 27, 27, 27, 27, 29, 29, 29, 29, 31, 31, 31, 31, 33, 33, 33, 33, 35, 35, 35, 35, 37, 37, 37, 37
Offset: 0

Views

Author

Keywords

Comments

Conjecture: number of roots of P(x) = x^n - x^(n-1) - x^(n-2) - ... - x - 1 in the right half-plane. - Michel Lagneau, Apr 09 2013

Crossrefs

Programs

  • Magma
    [1+2*Floor(n/4): n in [0..100]]; // Bruno Berselli, Jul 26 2014
    
  • Magma
    I:=[1,1,1,1,3,3,3,3,5]; [n le 9 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..100]]; // Vincenzo Librandi, Jul 25 2014
    
  • Mathematica
    Table[1 + 2 Floor[n/4], {n, 0, 100}] (* Bruno Berselli, Jul 26 2014 *)
    CoefficientList[Series[(1 + x^4)/(-1 + x)^2/(1 + x)/(x^2 + 1), {x, 0, 100}], x] (* Vincenzo Librandi, Jul 26 2014 *)
  • Python
    def A129756(n): return (n>>1)|1 # Chai Wah Wu, Jan 31 2023

Formula

a(n) = (Sum_{k=0..n} (k+1)*cos((n-k)*Pi/2)) + (1/4)*(2*cos(n*Pi/2) + 1 + (-1)^n) - 1, with n >= 0.
a(n) = 1 + 2*floor(n/4) = 1 + 2*A002265(n). - R. J. Mathar, Jun 10 2007
G.f.: (1+x^4)/((-1+x)^2*(1+x)*(x^2+1)). - R. J. Mathar, Nov 18 2007
a(n) = -1 + Sum_{k=0..n} ((1/12)*(-5*(k mod 4) + ((k+1) mod 4) + ((k+2) mod 4) + 7*((k+3) mod 4))). - Paolo P. Lava, Aug 21 2009
a(n) = n - A083219(n). - Michel Lagneau, Apr 09 2013
a(n) = (2*n + 1 + 2*cos(n*Pi/2) + cos(n*Pi) + 2*sin(n*Pi/2))/4. - Wesley Ivan Hurt, Oct 02 2017
From Stefano Spezia, May 26 2021: (Start)
E.g.f.: (cos(x) + cosh(x) + sin(x) + x*(cosh(x) + sinh(x)))/2.
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. (End)

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

Original entry on oeis.org

1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15, 16, 17, 16, 17, 18, 19, 18, 19, 20, 21, 20, 21, 22, 23, 22, 23, 24, 25, 24, 25, 26, 27, 26, 27, 28, 29, 28, 29, 30, 31, 30, 31, 32, 33, 32, 33, 34, 35, 34, 35, 36, 37, 36, 37, 38
Offset: 0

Views

Author

Paul Barry, Apr 27 2005

Keywords

Comments

Conjecture: number of roots of x^n + 1 in the left half-plane for n > 0. - Michel Lagneau, Oct 31 2012
Maximum bias of polyominoes with n+1 squares. Define the bias of a polyomino to be the difference between the number of black squares and the number of white squares when chessboard coloring is applied to the polyomino. Maximum bias for the value n is defined to be the maximum value of bias among all polyominoes of n squares. - John Mason, Dec 24 2013

Crossrefs

Cf. A008611.

Programs

  • GAP
    List([0..80],n->((n-1) mod 4)/2+(n+1)/2-1); # Muniru A Asiru, Oct 07 2018
  • Maple
    a:= n-> n-1 - 2*floor((n-1)/4):
    seq(a(n), n=0..75);  # Alois P. Heinz, Jan 24 2021
  • Mathematica
    CoefficientList[Series[(1 - x + x^2 + x^3)/(1 - x - x^4 + x^5), {x, 0, 100}], x] (* Vincenzo Librandi, Dec 31 2013 *)
    LinearRecurrence[{1,0,0,1,-1},{1,0,1,2,3},80] (* Harvey P. Dale, May 07 2018 *)
  • PARI
    a(n)=([0,1,0,0,0; 0,0,1,0,0; 0,0,0,1,0; 0,0,0,0,1; -1,1,0,0,1]^n*[1;0;1;2;3])[1,1] \\ Charles R Greathouse IV, Sep 02 2015
    

Formula

G.f.: (1-x+x^2+x^3)/(1-x-x^4+x^5)=(1+x^2+2x^3+x^4+2x^5+x^6)/(1-x^4)^2.
a(n) = sum{k=0..n, -mu(k mod 4)}.
a(n) = cos(Pi*n/2)/2-sin(Pi*n/2)/2+(-1)^n/4+(2n+1)/4.
a(n) = sum{k=0..n, Jacobi(2^k, 2k+1)} [Conjecture]. - Paul Barry, Jul 23 2005
a(n) = sum{k=0..n, Product{j=1..k, ((-1)^j)^(k-j+1)}}. - Paul Barry, Nov 09 2007
a(n) = A083219(n-1). - R. J. Mathar, Aug 28 2008
a(n) = numbers of times cos(-Pi/n+2k*Pi/n) < 0 for k = 0..n-1. - Michel Lagneau, Nov 02 2012
a(n) = ((n - 1) mod 4)/2 + (n+1)/2 - 1. - John Mason, Dec 24 2013
a(n) = A018837(n-1) for n > 2. - Georg Fischer, Oct 07 2018

Extensions

John Mason's contributions corrected for offset by Eric M. Schmidt, Dec 30 2013

A083220 a(n) = n + (n mod 4).

Original entry on oeis.org

0, 2, 4, 6, 4, 6, 8, 10, 8, 10, 12, 14, 12, 14, 16, 18, 16, 18, 20, 22, 20, 22, 24, 26, 24, 26, 28, 30, 28, 30, 32, 34, 32, 34, 36, 38, 36, 38, 40, 42, 40, 42, 44, 46, 44, 46, 48, 50, 48, 50, 52, 54, 52, 54, 56, 58, 56, 58, 60, 62, 60, 62, 64, 66, 64, 66, 68, 70, 68, 70, 72, 74
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 22 2003

Keywords

Examples

			G.f. = 2*x + 4*x^2 + 6*x^3 + 4*x^4 + 6*x^5 + 8*x^6 + 10*x^7 + 8*x^8 + 10*x^9 + ...
		

Crossrefs

Cf. A010873 (n mod 4), A083219, A187832.

Programs

  • Mathematica
    a[n_] := Mod[n, 4] + n; (* Michael Somos, Feb 23 2017 *)
  • PARI
    concat(0, Vec(-2*x*(x^3-x^2-x-1)/((x-1)^2*(x+1)*(x^2+1)) + O(x^100))) \\ Colin Barker, Oct 13 2014
    
  • PARI
    {a(n) = n%4 + n}; /* Michael Somos, Feb 23 2017 */

Formula

a(n) = 2*A083219(n).
a(n) = a(n-1) + 2*(n mod 2 + (n mod 4 -1)*(1- n mod 2)), a(0)=0.
a(n) = (3 - (-1)^n - (1+i)*(-i)^n - (1-i)*i^n + 2*n)/2 where i=sqrt(-1). - Colin Barker, Oct 13 2014
G.f.: -2*x*(x^3-x^2-x-1) / ((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Oct 13 2014
For n > 4, a(n) = a(n-4) + 4. - Zak Seidov, Feb 23 2017
G.f.: 1/(1-x)^2 + 1/(2*(1-x)) - 1/(2*(1+x)) - (1+x)/(1+x^2). - Michael Somos, Feb 23 2017
E.g.f.: (1 + x)*cosh(x) - cos(x) + (2 + x)*sinh(x) - sin(x). - Stefano Spezia, May 28 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) - 1/2 (A187832). - Amiram Eldar, Aug 21 2023

A212831 a(4*n) = 2*n, a(2*n+1) = 2*n+1, a(4*n+2) = 2*n+2.

Original entry on oeis.org

0, 1, 2, 3, 2, 5, 4, 7, 4, 9, 6, 11, 6, 13, 8, 15, 8, 17, 10, 19, 10, 21, 12, 23, 12, 25, 14, 27, 14, 29, 16, 31, 16, 33, 18, 35, 18, 37, 20, 39, 20, 41, 22, 43, 22, 45, 24, 47, 24, 49, 26, 51, 26, 53, 28, 55, 28, 57, 30, 59, 30, 61, 32, 63, 32, 65, 34, 67, 34, 69, 36, 71, 36, 73, 38, 75
Offset: 0

Views

Author

Paul Curtz, Aug 14 2012

Keywords

Comments

First differences: (1, 1, 1, -1, 3, -1, 3, -3, 5,...) = (1, A186422).
Second differences: (0, 0, -2, 4, -4, 4, -6, 8, ...) = (-1)^(n+1) * A201629(n).
Interleave the terms with even indices of the companion A215495 and this one to get (A215495(0), A212831(0), A215495(2), A212831(2),...) = (1, 0, 1, 2, 3, 2, 3, 4, 5, 4,...) = A106249, up to the initial term = A083219 = A083220/2.

Crossrefs

Programs

  • Magma
    [(1/4)*((1 +(-1)^n)*(1 - (-1)^Floor(n/2)) + (3 -(-1)^n)*n): n in [0..50]]; // G. C. Greubel, Apr 25 2018
  • Mathematica
    a[n_] := (1/4)*((-(1 + (-1)^n))*(-1 + (-1)^Floor[n/2]) - (-3 + (-1)^n)*n ); Table[a[n], {n, 0, 84}] (* Jean-François Alcover, Sep 18 2012 *)
    LinearRecurrence[{0,1,0,1,0,-1},{0,1,2,3,2,5},80] (* Harvey P. Dale, May 29 2016 *)
  • PARI
    A212831(n)=if(bittest(n,0), n, n\2+bittest(n,1)) \\ M. F. Hasler, Oct 21 2012
    
  • PARI
    for(n=0,50, print1((1/4)*((1 +(-1)^n)*(1 - (-1)^floor(n/2)) + (3 -(-1)^n)*n), ", ")) \\ G. C. Greubel, Apr 25 2018
    

Formula

a(n) + A215495(n) = A043547(n).
a(n) = -A214283(n)/A000108([n/2]).
a(n+1) = (A186421(n)=0,1,2,1,4,...) + 1.
a(2*n) = A052928(n+1).
a(n+2) - a(n) = 2, 2, 0, 2. (period 4).
a(n) = a(n-2) +a(n-4) -a(n-6); also holds for A215495(n).
G.f.: x*(1+2*x+2*x^2+x^4) / ( (x^2+1)*(x-1)^2*(1+x)^2 ). - R. J. Mathar, Aug 21 2012
a(n) = (1/4)*((1 +(-1)^n)*(1 - (-1)^floor(n/2)) + (3 -(-1)^n)*n). - G. C. Greubel, Apr 25 2018

Extensions

Corrected and edited by M. F. Hasler, Oct 21 2012
Showing 1-6 of 6 results.