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.

A104248 Lengths of successive runs of 1's in the Thue-Morse sequence A010060.

This page as a plain text file.
%I A104248 #24 Jan 30 2025 14:07:45
%S A104248 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,
%T A104248 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,
%U A104248 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
%N A104248 Lengths of successive runs of 1's in the Thue-Morse sequence A010060.
%C A104248 Also lengths of successive runs of 0's in the Thue-Morse sequence A010059.
%C A104248 Also lengths of successive runs of 2's in the Thue-Morse sequence A001285.
%C A104248 A variant of A036577, suggested by p. 4421 of Grytczuk.
%H A104248 Ray Chandler, <a href="/A104248/b104248.txt">Table of n, a(n) for n=1..10922</a>
%H A104248 Jaroslaw Grytczuk, <a href="http://dx.doi.org/10.1016/j.disc.2007.08.039">Thue type problems for graphs, points and numbers</a>, Discrete Math., 308 (2008), 4419-4429.
%F A104248 a(n) = A026465(2n).
%e A104248 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 ...
%t A104248 Map[Length,Most[Split[ThueMorse[Range[500]]]][[;;;;2]]] (* _Paolo Xausa_, Dec 19 2023 *)
%t A104248 Length/@DeleteCases[Split[ThueMorse[Range[450]]],_?(#[[1]]==0&)] (* _Harvey P. Dale_, Nov 09 2024 *)
%o A104248 (Python)
%o A104248 def A104248(n):
%o A104248     def iterfun(f,n=0):
%o A104248         m, k = n, f(n)
%o A104248         while m != k: m, k = k, f(k)
%o A104248         return m
%o A104248     def f(x):
%o A104248         c, s = x, bin(x)[2:]
%o A104248         l = len(s)
%o A104248         for i in range(l&1^1,l,2):
%o A104248             c -= int(s[i])+int('0'+s[:i],2)
%o A104248         return c
%o A104248     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
%Y A104248 Cf. A010060, A036577, A143331.
%Y A104248 Cf. A001285, A010059, A026465.
%K A104248 nonn,easy
%O A104248 1,1
%A A104248 _N. J. A. Sloane_, Aug 05 2008
%E A104248 Edited and extended by _Ray Chandler_, Aug 08 2008