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.

A143331 Lengths of successive runs of 0's in the Thue-Morse sequence A010060.

Original entry on oeis.org

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

Views

Author

Ray Chandler, Aug 08 2008

Keywords

Comments

Also lengths of successive runs of 1's in the Thue-Morse sequence A010059.
Also lengths of successive runs of 1's in the Thue-Morse sequence A001285.

Examples

			A010060 begins 011010011001011010010110011010011... so the runs of 0's have lengths 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 ...
		

Crossrefs

Programs

  • Mathematica
    Map[Length,Most[Split[ThueMorse[Range[0,500]]]][[;;;;2]]] (* Paolo Xausa, Dec 19 2023 *)
  • Python
    def A143331(n):
        if n==1: return 1
        def iterfun(f,n=0):
            m, k = n, f(n)
            while m != k: m, k = k, f(k)
            return m
        def f(x):
            c, s = x, bin(x)[2:]
            l = len(s)
            for i in range(l&1^1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return iterfun(lambda x:f(x)+(n<<1)-1,(n<<1)-1)-iterfun(lambda x:f(x)+(n-1<<1),(n-1<<1)) # Chai Wah Wu, Jan 30 2025

Formula

a(n) = A026465(2n-1).