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.

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

This page as a plain text file.
%I A057211 #41 Jun 19 2024 10:37:21
%S A057211 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,
%T A057211 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,
%U A057211 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
%N A057211 Alternating runs of ones and zeros, where the n-th run has length n.
%C A057211 Seen as a triangle read by rows: T(n,k) = n mod 2, 1<=k<=n. - _Reinhard Zumkeller_, Mar 18 2011
%C A057211 a(A007607(n)) = 0; a(A007606(n)) = 1. - _Reinhard Zumkeller_, Dec 30 2011
%C A057211 Row sums give A193356. - _Omar E. Pol_, Mar 05 2014
%D A057211 K. H. Rosen, Discrete Mathematics and its Applications, 1999, Fourth Edition, page 79, exercise 10 (g).
%H A057211 Reinhard Zumkeller, <a href="/A057211/b057211.txt">Rows n=1..125 of triangle, flattened</a>
%H A057211 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F A057211 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
%F A057211 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
%F A057211 G.f.: x/(1-x)*sum_{n>=0} (-1)^n*x^(n*(n+1)/2). - _Mircea Merca_, Mar 05 2014
%F A057211 a(n) = 1 - A057212(n). - _Alois P. Heinz_, Oct 06 2021
%p A057211 A002024 := n->round(sqrt(2*n)):A057211 := n->(1-(-1)^A002024(n))/2;
%p A057211 # alternative Maple program:
%p A057211 T:= n-> [irem(n, 2)$n][]:
%p A057211 seq(T(n), n=1..14);  # _Alois P. Heinz_, Oct 06 2021
%t A057211 Flatten[Table[{PadRight[{},n,1],PadRight[{},n+1,0]},{n,1,21,2}]] (* _Harvey P. Dale_, Jun 07 2015 *)
%o A057211 (Haskell)
%o A057211 a057211 n = a057211_list !! (n-1)
%o A057211 a057211_list = concat $ zipWith ($) (map replicate [1..]) a059841_list
%o A057211 -- _Reinhard Zumkeller_, Mar 18 2011
%o A057211 (Python)
%o A057211 from math import isqrt
%o A057211 def A057211(n): return int(bool(isqrt(n<<3)+1&2)) # _Chai Wah Wu_, Jun 19 2024
%Y A057211 Cf. A057212, A059841.
%K A057211 nonn,tabl
%O A057211 1,1
%A A057211 Ben Tyner (tyner(AT)phys.ufl.edu), Sep 27 2000
%E A057211 Definition amended by _Georg Fischer_, Oct 06 2021