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.

A030301 n-th run has length 2^(n-1).

This page as a plain text file.
%I A030301 #38 Apr 12 2023 10:07:52
%S A030301 0,1,1,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,0,0,0,1,1,1,
%T A030301 1,1,1,1,1,1,1,1,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,
%U A030301 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,0,0,0
%N A030301 n-th run has length 2^(n-1).
%H A030301 Antti Karttunen, <a href="/A030301/b030301.txt">Table of n, a(n) for n = 1..65537</a>
%H A030301 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H A030301 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F A030301 a(n) = A000523(n) mod 2 = (A029837(n+1)+1) mod 2.
%F A030301 a(n) = 0 iff n has an odd number of digits in binary, = 1 otherwise. - _Henry Bottomley_, Apr 06 2000
%F A030301 a(n) = (1/2)*{1-(-1)^floor(log(n)/log(2))}. - _Benoit Cloitre_, Nov 22 2001
%F A030301 a(n) = 1-a(floor(n/2)). - _Vladeta Jovovic_, Aug 04 2003
%F A030301 a(n) = 1 - A030300(n). - _Antti Karttunen_, Oct 10 2017
%t A030301 nMax = 7; Table[1 - Mod[n, 2], {n, nMax}, {2^(n-1)}] // Flatten (* _Jean-François Alcover_, Oct 20 2016 *)
%t A030301 Table[{PadRight[{},2^(n-1),0],PadRight[{},2^n,1]},{n,1,8,2}]//Flatten (* _Harvey P. Dale_, Apr 12 2023 *)
%o A030301 (PARI) a(n)=if(n<1,0,1-length(binary(n))%2)
%o A030301 (PARI) a(n)=if(n<1,0,if(n%2==0,-a(n/2)+1,-a((n-1)/2)+1-(((n-1)/2)==0))) /* _Ralf Stephan_ */
%o A030301 (Magma) [Floor(Log(n)/Log(2)) mod 2: n in [1..100]]; // _Vincenzo Librandi_, Jun 23 2015
%o A030301 (Python)
%o A030301 def A030301(n): return n.bit_length()&1^1 # _Chai Wah Wu_, Jan 30 2023
%Y A030301 Cf. A000523, A029837.
%Y A030301 Cf. A030300. Partial sums give A079954.
%Y A030301 Characteristic function of A053754 (after its initial 0).
%K A030301 nonn,base,easy
%O A030301 1,1
%A A030301 _Jean-Paul Delahaye_