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.

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.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Dec 20 2024

Keywords

Comments

See A378282 for a guide to related arrays and sequences.

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

Crossrefs

Cf. A378282, A378304, A378305, A378306, A378307 (row lengths)

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 *)