The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A214215 List of subwords (or factors) of the Thue-Morse "1,2"-word A001285. 1

%I #12 Nov 22 2020 12:22:32

%S 1,2,11,12,21,22,112,121,122,211,212,221,1121,1122,1211,1212,1221,

%T 2112,2121,2122,2211,2212,11212,11221,12112,12122,12211,12212,21121,

%U 21122,21211,21221,22112,22121,112122,112211,112212,121121,121122,121221,122112,122121

%N List of subwords (or factors) of the Thue-Morse "1,2"-word A001285.

%C The number of factors of length m is given by A005942(m).

%H Alois P. Heinz, <a href="/A214215/b214215.txt">Table of n, a(n) for n = 1..10200</a>

%p b:= proc(n) option remember; local r;

%p `if`(n=0, 1, `if`(n<4, 2*n, `if`(irem(n, 2, 'r')=0,

%p b(r)+b(r+1), 2*b(r+1))))

%p end:

%p m:= proc(n) option remember; local r;

%p `if`(n=0, 1, `if`(irem(n, 2, 'r')=0, m(r), 3-m(r)))

%p end:

%p T:= proc(n) local k, s; s:={};

%p for k while nops(s)<b(n) do

%p s:= s union {parse(cat(seq(m(i), i=k..k+n-1)))}

%p od; sort([s[]])[]

%p end:

%p seq(T(n), n=1..10); # _Alois P. Heinz_, Jul 19 2012

%t b[n_] := b[n] = Module[{r}, If[n == 0, 1, If[n < 4, 2n, r = Quotient[n, 2]; If[Mod[n, 2] == 0, b[r] + b[r + 1], 2b[r + 1]]]]];

%t m[n_] := m[n] = Module[{r}, If[n == 0, 1, r = Quotient[n, 2]; If[Mod[n, 2] == 0, m[r], 3 - m[r]]]];

%t T[n_] := Module[{k, s = {}}, For[k = 1, Length[s] < b[n], k++, s = s ~Union~ {FromDigits[#]}& @ Table[m[i], {i, k, k + n - 1}]]; Sort[s]];

%t Array[T, 10] // Flatten (* _Jean-François Alcover_, Nov 22 2020, after _Alois P. Heinz_ *)

%Y Cf. A001285, A010060, A005942.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Jul 10 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 10 00:22 EDT 2024. Contains 373251 sequences. (Running on oeis4.)