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.

A057211 Alternating runs of ones and zeros, where the n-th run has length n.

Original entry on oeis.org

1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Ben Tyner (tyner(AT)phys.ufl.edu), Sep 27 2000

Keywords

Comments

Seen as a triangle read by rows: T(n,k) = n mod 2, 1<=k<=n. - Reinhard Zumkeller, Mar 18 2011
a(A007607(n)) = 0; a(A007606(n)) = 1. - Reinhard Zumkeller, Dec 30 2011
Row sums give A193356. - Omar E. Pol, Mar 05 2014

References

  • K. H. Rosen, Discrete Mathematics and its Applications, 1999, Fourth Edition, page 79, exercise 10 (g).

Crossrefs

Programs

  • Haskell
    a057211 n = a057211_list !! (n-1)
    a057211_list = concat $ zipWith ($) (map replicate [1..]) a059841_list
    -- Reinhard Zumkeller, Mar 18 2011
    
  • Maple
    A002024 := n->round(sqrt(2*n)):A057211 := n->(1-(-1)^A002024(n))/2;
    # alternative Maple program:
    T:= n-> [irem(n, 2)$n][]:
    seq(T(n), n=1..14);  # Alois P. Heinz, Oct 06 2021
  • Mathematica
    Flatten[Table[{PadRight[{},n,1],PadRight[{},n+1,0]},{n,1,21,2}]] (* Harvey P. Dale, Jun 07 2015 *)
  • Python
    from math import isqrt
    def A057211(n): return int(bool(isqrt(n<<3)+1&2)) # Chai Wah Wu, Jun 19 2024

Formula

a(n) = (1-(-1)^A002024(n))/2, where A002024(n)=round(sqrt(2*n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 23 2003
Also a(n) = A000035(A002024(n)) = A002024(n) mod 2 = A002024(n)-2*floor(A002024(n)/2). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 23 2003
G.f.: x/(1-x)*sum_{n>=0} (-1)^n*x^(n*(n+1)/2). - Mircea Merca, Mar 05 2014
a(n) = 1 - A057212(n). - Alois P. Heinz, Oct 06 2021

Extensions

Definition amended by Georg Fischer, Oct 06 2021

A138150 n-th run has length n-th prime, with digits 0 and 1 only, starting with 0.

Original entry on oeis.org

0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Omar E. Pol, Mar 29 2008

Keywords

Examples

			.n ..... Run ....................... Length
.1 ..... 0,0 ....................... 2
.2 ..... 1,1,1 ..................... 3
.3 ..... 0,0,0,0,0 ................. 5
.4 ..... 1,1,1,1,1,1,1 ............. 7
.5 ..... 0,0,0,0,0,0,0,0,0,0,0 ..... 11
		

Crossrefs

Programs

  • Mathematica
    With[{nn=11},Riffle[Table[PadRight[{},Prime[n],0],{n,1,nn,2}],Table[ PadRight[ {},Prime[n+1],1],{n,1,nn,2}]]//Flatten] (* Harvey P. Dale, Nov 28 2018 *)

A005996 G.f.: 2*(1-x^3)/((1-x)^5*(1+x)^2).

Original entry on oeis.org

2, 6, 16, 30, 54, 84, 128, 180, 250, 330, 432, 546, 686, 840, 1024, 1224, 1458, 1710, 2000, 2310, 2662, 3036, 3456, 3900, 4394, 4914, 5488, 6090, 6750, 7440, 8192, 8976, 9826, 10710, 11664, 12654, 13718, 14820, 16000, 17220, 18522, 19866, 21296, 22770, 24334
Offset: 1

Views

Author

Keywords

Comments

a(n) is also the number of triples (w,x,y) having all terms in {0,...,n} and wClark Kimberling, Jun 10 2012
a(n) is also the sum of all elements of the square matrix M(n-1) = M1(n-1) x M2(n-1), where M1(n) is the square matrix with elements m1(i,j)= (1+(-1)^(i+j+1))/2, A057212; and M2(n) is the square matrix given by m2(i,j)= (1+(-1)^(i+j))/2, A057212. - Enrique Pérez Herrero, Jun 15 2013
Also the number of longest paths in the (n+1)-web graph for n > 2. - Eric W. Weisstein, Mar 27 2018
a(n) also is the number of undirected rook moves on an n X n chessboard, taken up to 180 degree rotation and axial reflections (horizontal and vertical), for n >= 2. - Hilko Koning, Aug 16 2025

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Essentially twice A034828.

Programs

  • Mathematica
    Table[(1/4)*(1 + n)*(-2 + 5*n + n^2 + 2*Ceiling[1/2 - n/2] - 4*Floor[n/2]), {n, 1, 200}] (* Enrique Pérez Herrero, Aug 03 2012 *)
    CoefficientList[Series[2 (1 - x^3)/((1 - x)^5 (1 + x)^2), {x, 0, 40}], x] (* Harvey P. Dale, Apr 08 2013 *)
    LinearRecurrence[{2, 1, -4, 1, 2, -1}, {2, 6, 16, 30, 54, 84}, 40] (* Harvey P. Dale, Apr 08 2013 *)
    Table[(n + 1) (2 n (n + 2) + 1 - (-1)^n)/8, {n, 20}] (* Eric W. Weisstein, Mar 27 2018 *)

Formula

a(n) = 2*(A006918(n) + A006918(n-1) + A006918(n-2)), n>1. - Ralf Stephan, Apr 26 2003
a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6), with a(1)=2, a(2)=6, a(3)=16, a(4)=30, a(5)=54, a(6)=84. - Harvey P. Dale, Apr 08 2013
From Ayoub Saber Rguez, Nov 20 2021: (Start)
a(n) = A143785(n) - A002620(n+1).
a(n) = A128624(n) + A002620(n+1).
a(n) = (n^3 + 3*n^2 + 2*n + 1 + n*(n mod 2) - ((n+1) mod 2))/4. (End)

Extensions

Edited by N. J. A. Sloane, Aug 03 2012

A138710 n-th run has length n-th positive Fibonacci numbers, with digits 0 and 1 only, starting with 0.

Original entry on oeis.org

0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Omar E. Pol, Mar 29 2008

Keywords

Examples

			.n ..... Run ................. Length
.1 ..... 0 ................... 1
.2 ..... 1 ................... 1
.3 ..... 0,0 ................. 2
.4 ..... 1,1,1 ............... 3
.5 ..... 0,0,0,0,0 ........... 5
.6 ..... 1,1,1,1,1,1,1,1 ..... 8
		

Crossrefs

A138712 n-th run has length n-th positive triangular number, with digits 0 and 1 only, starting with 0.

Original entry on oeis.org

0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Omar E. Pol, Mar 29 2008

Keywords

Examples

			.n ..... Run ............................... Length
.1 ..... 0 ................................. 1
.2 ..... 1,1,1 ............................. 3
.3 ..... 0,0,0,0,0,0........................ 6
.4 ..... 1,1,1,1,1,1,1,1,1,1 ............... 10
.5 ..... 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ..... 15
		

Crossrefs

A201208 One 1, two 2's, three 1's, four 2's, five 1's, ...

Original entry on oeis.org

1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Paul Curtz, Nov 28 2011

Keywords

Examples

			May be written as a triangle:
  1
  2 2
  1 1 1
  2 2 2 2
  1 1 1 1 1
  2 2 2 2 2 2
  1 1 1 1 1 1 1
Row sums are A022998(n+1).
		

Crossrefs

Programs

  • Haskell
    a201208 n = a201208_list !! (n-1)
    a201208_list = concat $ zipWith ($) (map replicate [1..]) a000034_list
    -- Reinhard Zumkeller, Dec 02 2011
  • Mathematica
    ReplaceAll[ColumnForm[Table[Mod[k, 2], {k, 12}, {n, k}], Center], 0 -> 2] (* Alonso del Arte, Nov 28 2011 *)

Formula

a(n) = A057212(n) + 1. - T. D. Noe, Nov 28 2011

Extensions

Edited by N. J. A. Sloane, Dec 02 2011
Showing 1-6 of 6 results.