(Translated by https://www.hiragana.jp/)
A203531 - OEIS
login
A203531
Run lengths in Golay-Rudin-Shapiro sequence A020985.
2
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,1
COMMENTS
a(2*n) = length of n-th run of 1s; a(2*n+1) = length of n-th run of -1s.
LINKS
Eric Weisstein's World of Mathematics, Rudin-Shapiro Sequence
PROG
(Haskell)
import Data.List (group)
a203531 n = a203531_list !! n
a203531_list = map length $ group a020985_list
(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
CROSSREFS
Cf. A020985.
Sequence in context: A257915 A257904 A257980 * A324885 A046645 A284639
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 02 2012
STATUS
approved