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.

A203531 Run lengths in Golay-Rudin-Shapiro sequence A020985.

Original entry on oeis.org

3, 1, 2, 1, 4, 3, 1, 1, 3, 1, 2, 1, 1, 3, 3, 1, 4, 1, 2, 1, 4, 3, 1, 4, 1, 2, 1, 1, 3, 3, 1, 1, 3, 1, 2, 1, 4, 3, 1, 1, 3, 1, 2, 1, 1, 3, 3, 1, 1, 3, 1, 2, 1, 4, 3, 1, 4, 1, 2, 1, 1, 3, 3, 1, 4, 1, 2, 1, 4, 3, 1, 1, 3, 1, 2, 1, 1, 3, 3, 1, 4, 1, 2, 1, 4, 3
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 02 2012

Keywords

Comments

a(2*n) = length of n-th run of 1s; a(2*n+1) = length of n-th run of -1s.

Crossrefs

Cf. A020985.

Programs

  • Haskell
    import Data.List (group)
    a203531 n = a203531_list !! n
    a203531_list = map length $ group a020985_list
    
  • Mathematica
    Map[Length, Most[Split[RudinShapiro[Range[0, 200]]]]] (* Paolo Xausa, Jan 29 2025 *)
  • Python
    from itertools import count, islice
    def A203531_gen(): # generator of terms
        c, a = 0, 1
        for n in count(0):
            if (n&(n>>1)).bit_count()&1^a:
                c += 1
            else:
                yield c
                c = 1
                a ^= 1
    A293531_list = list(islice(A203531_gen(),30)) # Chai Wah Wu, Feb 11 2023