A378303 Irregular triangular T: (row 1) = (1); (row n+1) = inverse runlength sequence of row n, starting with 1 if r = 3k for some k, and 2 otherwise. See Comments.
1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2
Offset: 1
Examples
First nine rows: 1 2 2, 2 1, 1, 2, 2 2, 1, 2, 2, 1, 1 2, 2, 1, 2, 2, 1, 1, 2, 1 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2 (row 9) = (2,2,1,2,2,1,...) has runlength sequence (2,1,2,2,...) = (row 8).
Programs
-
Mathematica
invRE[seq_, k_] := Flatten[Map[ConstantArray[#[[2]], #[[1]]] &, Partition[Riffle[seq, {k, 2 - Mod[k + 1, 2]}, {2, -1, 2}], 2]]]; row1 = {1}; rows = {row1}; col = PadRight[{}, 18, {1, 2, 2}] Do[AppendTo[rows, invRE[Last[rows], col[[n]]]], {n, 2, Length[col]}] rows // ColumnForm (* array *) Flatten[rows] (* sequence *) (* Peter J. C. Moses, Nov 21 2024 *)
Comments