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 A379046 #15 May 30 2025 23:16:01 %S A379046 1,2,3,4,5,12,6,9,17,32,7,14,39,66,93,8,19,52,125,134,257,10,23,57, %T A379046 154,318,351,378,11,27,71,194,512,639,702,471,13,29,84,216,553,1627, %U A379046 1672,789,798,15,36,98,230,594,2141,2168,1747,1960,825,16,41,111,309 %N A379046 Rectangular array read by descending antidiagonals: the Type 1 runlength index array of A000002 (the Kolakoski sequence); see Comments. %C A379046 We begin with a definition of Type 1 runlength array, U(s), of a sequence s: %C A379046 Suppose s is a sequence (finite or infinite), and define rows of U(s) as follows: %C A379046 (row 0) = s %C A379046 (row 1) = sequence of 1st terms of runs in (row 0); c(1) = complement of (row 1) in (row 0) %C A379046 For n>=2, %C A379046 (row n) = sequence of 1st terms of runs in c(n-1); c(n) = complement of (row n) in (row n-1), %C A379046 where the process stops if and when c(n) is empty for some n. %C A379046 *** %C A379046 The corresponding Type 1 runlength index array, UI(s) is now contructed from U(s) in two steps: %C A379046 (1) Let U*(s) be the array obtaining by repeating the construction of U(s) using (n,s(n)) in place of s(n). %C A379046 (2) Then UI(s) results by retaining only n in U*. %C A379046 Thus, loosely speaking, (row n) of UI(s) shows the indices in s of the numbers in (row n) of U(s). %C A379046 The array UI(s) includes every positive integer exactly once. %e A379046 Corner: %e A379046 1 2 4 6 7 8 10 11 13 15 16 18 %e A379046 3 5 9 14 19 23 27 29 36 41 45 49 %e A379046 12 17 39 52 57 71 84 98 111 116 139 161 %e A379046 32 66 125 154 194 216 230 309 430 462 491 526 %e A379046 93 134 318 512 553 594 943 1004 1330 1371 1594 1826 %e A379046 257 351 639 1627 2141 2490 2612 2869 3501 3761 3990 4191 %e A379046 378 702 1672 2168 2896 3564 3806 4017 4218 4935 5054 5418 %e A379046 471 789 1747 2729 2905 3651 4547 6578 6763 7768 7962 8185 %e A379046 798 1960 2756 2932 3660 4574 6659 6936 8368 9370 10296 12393 %e A379046 825 1987 2783 3415 3687 4601 8455 9433 10359 12426 13180 15836 %e A379046 Starting with s = A000002, we have for U*(s): %e A379046 (row 1) = ((1,1), (2,2), (4,1), (6,2), (7,1), (8,2), (10,1), (11,2), (13,1), ...) %e A379046 c(1) = ((3,2), (5,1), (9,2), (12,2), (14,1), (17,1), (19,2), (23,1), (27,2), ...) %e A379046 (row 2) = ((3,2), (5,1), (9,2), (14,1), (19,2), (23,1), (27,2), (29,1), (36,2), ...) %e A379046 c(2) = ((12,2), (17,1), (32,1), (39,2), (52,1), (57,2), (66,2), (71,1), ...) %e A379046 (row 3) = ((12,2), (17,1), (39,2), (52,1), (57,2), (71,1), ...) %e A379046 so that UI(s) has %e A379046 (row 1) = (1,2,4,6,7,8,10,11,13,...) %e A379046 (row 2) = (3,5,9,14,19,...) %e A379046 (row 3) = (12,17,32,66,...) %t A379046 r[seq_] := seq[[Flatten[Position[Prepend[Differences[seq[[All, 1]]], 1], _?(# != 0 &)]], 2]]; (* Type 1 *) %t A379046 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 A379046 row[0] = Transpose[{#, Range[Length[#]]}] &[row[0]]; %t A379046 k = 0; Quiet[While[Head[row[k]] === List, row[k + 1] = row[0][[r[ %t A379046 SortBy[Apply[Complement, Map[row[#] &, Range[0, k]]], #[[2]] &]]]]; k++]]; %t A379046 m = Map[Map[#[[2]] &, row[#]] &, Range[k - 1]]; %t A379046 p[n_] := Take[m[[n]], 12] %t A379046 t = Table[p[n], {n, 1, 12}] %t A379046 Grid[t] (* array *) %t A379046 w[n_, k_] := t[[n]][[k]]; %t A379046 Table[w[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (* sequence *) %t A379046 (* _Peter J. C. Moses_, Dec 04 2024 *) %Y A379046 Cf. A000002, A379047 (Type 2 array). %K A379046 nonn,tabl %O A379046 1,2 %A A379046 _Clark Kimberling_, Dec 16 2024