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”).

A214215
List of subwords (or factors) of the Thue-Morse "1,2"-word A001285.
2
1, 2, 11, 12, 21, 22, 112, 121, 122, 211, 212, 221, 1121, 1122, 1211, 1212, 1221, 2112, 2121, 2122, 2211, 2212, 11212, 11221, 12112, 12122, 12211, 12212, 21121, 21122, 21211, 21221, 22112, 22121, 112122, 112211, 112212, 121121, 121122, 121221, 122112, 122121
OFFSET
1,2
COMMENTS
The number of factors of length m is given by A005942(m).
LINKS
MAPLE
b:= proc(n) option remember; local r;
`if`(n=0, 1, `if`(n<4, 2*n, `if`(irem(n, 2, 'r')=0,
b(r)+b(r+1), 2*b(r+1))))
end:
m:= proc(n) option remember; local r;
`if`(n=0, 1, `if`(irem(n, 2, 'r')=0, m(r), 3-m(r)))
end:
T:= proc(n) local k, s; s:={};
for k while nops(s)<b(n) do
s:= s union {parse(cat(seq(m(i), i=k..k+n-1)))}
od; sort([s[]])[]
end:
seq(T(n), n=1..10); # Alois P. Heinz, Jul 19 2012
MATHEMATICA
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]]]]];
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[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]];
Array[T, 10] // Flatten (* Jean-François Alcover, Nov 22 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jul 10 2012
STATUS
approved