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-2 of 2 results.

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

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030300. Partial sums give A079954.
Characteristic function of A053754 (after its initial 0).

Programs

  • Magma
    [Floor(Log(n)/Log(2)) mod 2: n in [1..100]]; // Vincenzo Librandi, Jun 23 2015
    
  • Mathematica
    nMax = 7; Table[1 - Mod[n, 2], {n, nMax}, {2^(n-1)}] // Flatten (* Jean-François Alcover, Oct 20 2016 *)
    Table[{PadRight[{},2^(n-1),0],PadRight[{},2^n,1]},{n,1,8,2}]//Flatten (* Harvey P. Dale, Apr 12 2023 *)
  • PARI
    a(n)=if(n<1,0,1-length(binary(n))%2)
    
  • 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 */
    
  • Python
    def A030301(n): return n.bit_length()&1^1 # Chai Wah Wu, Jan 30 2023

Formula

a(n) = A000523(n) mod 2 = (A029837(n+1)+1) mod 2.
a(n) = 0 iff n has an odd number of digits in binary, = 1 otherwise. - Henry Bottomley, Apr 06 2000
a(n) = (1/2)*{1-(-1)^floor(log(n)/log(2))}. - Benoit Cloitre, Nov 22 2001
a(n) = 1-a(floor(n/2)). - Vladeta Jovovic, Aug 04 2003
a(n) = 1 - A030300(n). - Antti Karttunen, Oct 10 2017

A079947 Partial sums of A030300.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 22 2003

Keywords

Programs

  • Mathematica
    Accumulate@ Flatten@ Table[1 - Mod[n, 2], {n, 0, 6}, {2^n}] (* Michael De Vlieger, Oct 29 2022 *)
  • PARI
    a(n) = my(k=logint(n,2), p=(2<Kevin Ryde, Jul 13 2019 */
    
  • Python
    def A079947(n): return n-((1<Chai Wah Wu, Jan 30 2023

Formula

a(n) = (n+1+(2/3)*(4^e_4-1)+(-1)^e_2*(n-1-2*(4^e_4-1)))/2 where e_4=floor(log[4](n)) and e_2=floor(log[2](n))=floor(log[4](n^2)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 22 2003
a(n) = n - A079954(n). Let k=A000523(n), then a(n) = n-A000975(k) if k even, or a(n) = A000975(k) if k odd. - Kevin Ryde, Jul 13 2019
Showing 1-2 of 2 results.