login
Triangular array: row n is least squarefree word of length n using positive integers.
1

%I #18 Dec 04 2016 19:46:31

%S 1,1,2,1,2,1,1,2,1,3,1,2,1,3,1,1,2,1,3,1,2,1,2,1,3,1,2,1,1,2,1,3,1,2,

%T 1,4,1,2,1,3,1,2,1,4,1,1,2,1,3,1,2,1,4,1,2,1,2,1,3,1,2,1,4,1,2,1,1,2,

%U 1,3,1,2,1,4,1,2,1,3,1,2,1,3,1,2,1,4

%N Triangular array: row n is least squarefree word of length n using positive integers.

%C Squarefree means that the word contains no consecutive identical subwords.

%H Clark Kimberling, <a href="/A225743/b225743.txt">Table of n, a(n) for n = 1..10000</a>

%e The first 10 rows are shown here:

%e 1

%e 1 2

%e 1 2 1

%e 1 2 1 3

%e 1 2 1 3 1

%e 1 2 1 3 1 2

%e 1 2 1 3 1 2 1

%e 1 2 1 3 1 2 1 4

%e 1 2 1 3 1 2 1 4 1

%e 1 2 1 3 1 2 1 4 1 2

%e 1 contains no square; 11 contains a square but 12 does not; 121 contains no square; both 1211 and 1212 have squares but 1213 does not.

%t squareFreeQ[string_] := StringFreeQ[string, a__ ~~ a__]; t = {}; s = Table[AppendTo[t, NestWhile[# + 1 &, 1, ! squareFreeQ[ToString[FromDigits[Append[t, #]]]] &]], {20}];

%t TableForm[s] (* A225743 array *)

%t Flatten[s] (* A225743 sequence *)

%t Map[IntegerExponent[2*#, 2] &, Range[Range[33]]] (* A225743 array, by formula *)

%t (* _Peter J. C. Moses_, Sep 03 2013 *)

%Y Cf. A001511 (the limiting sequence)

%K nonn,tabl,easy

%O 1,3

%A _Clark Kimberling_, Sep 03 2013