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.
%I A379047 #11 Dec 20 2024 12:04:11 %S A379047 1,3,2,5,4,8,6,11,28,13,7,16,35,80,53,9,18,48,121,217,112,10,22,62, %T A379047 135,449,332,305,12,26,67,175,472,1478,1451,296,14,31,89,203,513,1974, %U A379047 1947,1358,1331,15,38,94,244,812,2101,2683,1920,1827,964,17,40,107 %N A379047 Rectangular array read by descending antidiagonals: the Type 2 runlength index array of A000002 (the Kolakoski sequence); see Comments. %C A379047 We begin with a definition of Type 2 runlength array, V(s), of any sequence s for which all the runs referred to have finite length: %C A379047 Suppose s is a sequence (finite or infinite), and define rows of V(s) as follows: %C A379047 (row 0) = s %C A379047 (row 1) = sequence of last terms of runs in (row 0); c(1) = complement of (row 1) in (row 0) %C A379047 For n>=2, %C A379047 (row n) = sequence of last terms of runs in c(n-1); c(n) = complement of (row n) in (row n-1), %C A379047 where the process stops if and when c(n) is empty for some n. %C A379047 *** %C A379047 The corresponding Type 2 runlength index array, The runlength index array, VI(s) is now contructed from V(s) in two steps: %C A379047 (1) Let V*(s) be the array obtaining by repeating the construction of V(s) using (n,s(n)) in place of s(n). %C A379047 (2) Then VI(s) results by retaining only n in V*. %C A379047 Thus, loosely speaking, (row n) of VI(s) shows the indices in s of the numbers in (row n) of V(s). %C A379047 The array VI(s) includes every positive integer exactly once. %C A379047 *** %C A379047 Examples: (1) if s is monotonic, then VI(s) has just one row, the positive integers, A000027. %C A379047 (2) if s = A010060 (Thue-Morse sequence), then VI(s) has exactly two rows: A003159 and A036554. The type 1 runlength index array of s also has exactly two rows: A285385 and A072989. %e A379047 Corner: %e A379047 1 3 5 6 7 9 10 12 14 15 17 19 %e A379047 2 4 11 16 18 22 26 31 38 40 44 51 %e A379047 8 28 35 48 62 67 89 94 107 130 150 157 %e A379047 13 80 121 135 175 203 244 359 417 458 499 540 %e A379047 53 217 449 472 513 812 879 1069 1272 1511 1725 1786 %e A379047 112 332 1478 1974 2101 2423 2710 3282 3638 3715 3950 4145 %e A379047 305 1451 1947 2683 2883 3605 3706 3827 4528 4749 4963 5076 %e A379047 296 1358 1920 2590 2850 3542 5745 6400 7103 7567 7796 8346 %e A379047 1331 1827 2491 2805 3437 5652 6373 7769 8265 9315 11508 11738 %e A379047 Using s = A000002 as an example, we have for V*(s): %e A379047 (row 1) = ((1,1), (3,2), (5,1), (6,2), (7,1), (9,2), (10,1), (12,2), (14,1),...) %e A379047 c(1) = ((2,2), (4,1), (8,2), (11,2), (13,1), (16,1), (18,2), (22,1), (26,2), ...) %e A379047 (row 2) = ((2,2), (4,1), (11,2), (16,1), (18,2), (22,1), (26,2), (31,1), (35,2), ...) %e A379047 c(2) = (8,2), (13,1), (28,1), ...) %e A379047 (row 3) = (8,2), (28,1), %e A379047 so that VI(s) has %e A379047 (row 1) = (1,3,5,6,7,9,10,12, ...) %e A379047 (row 2) = (2,4,11,16,18,22,26, ...) %e A379047 (row 3) = (8,28,35,48,62,67,...) %t A379047 r[seq_] := seq[[Flatten[Position[Append[Differences[seq[[All, 1]]], 1], _?(# != 0 &)]], 2]]; (* Type 1 *) %t A379047 row[0] = Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, 24], 1]; (* A000002 *) %t A379047 row[0] = Transpose[{#, Range[Length[#]]}] &[row[0]]; %t A379047 k = 0; Quiet[While[Head[row[k]] === List, row[k + 1] = row[0][[r[ %t A379047 SortBy[Apply[Complement, Map[row[#] &, Range[0, k]]], #[[2]] &]]]]; k++]]; %t A379047 m = Map[Map[#[[2]] &, row[#]] &, Range[k - 1]]; %t A379047 p[n_] := Take[m[[n]], 12] %t A379047 t = Table[p[n], {n, 1, 12}] %t A379047 Grid[t] (* array *) %t A379047 w[n_, k_] := t[[n]][[k]]; %t A379047 Table[w[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (* sequence *) %t A379047 (* _Peter J. C. Moses_, Dec 04 2024 *) %Y A379047 Cf. A000002, A379046 (Type 1 array). %K A379047 nonn,tabl %O A379047 1,2 %A A379047 _Clark Kimberling_, Dec 16 2024