login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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