A104248 Lengths of successive runs of 1's in the Thue-Morse sequence A010060.
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, 2, 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, 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 2
Offset: 1
Examples
A010060 begins 011010011001011010010110011010011... so the runs of 1's have lengths 2 1 2 1 2 1 1 2 2 1 2 1 2 2 1 1 2 1 ...
Links
- Ray Chandler, Table of n, a(n) for n=1..10922
- Jaroslaw Grytczuk, Thue type problems for graphs, points and numbers, Discrete Math., 308 (2008), 4419-4429.
Programs
-
Mathematica
Map[Length,Most[Split[ThueMorse[Range[500]]]][[;;;;2]]] (* Paolo Xausa, Dec 19 2023 *) Length/@DeleteCases[Split[ThueMorse[Range[450]]],?(#[[1]]==0&)] (* _Harvey P. Dale, Nov 09 2024 *)
-
Python
def A104248(n): 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),n<<1)-iterfun(lambda x:f(x)+(n<<1)-1,(n<<1)-1) # Chai Wah Wu, Jan 30 2025
Formula
a(n) = A026465(2n).
Extensions
Edited and extended by Ray Chandler, Aug 08 2008
Comments