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.

A379046 Rectangular array read by descending antidiagonals: the Type 1 runlength index array of A000002 (the Kolakoski sequence); see Comments.

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 6, 9, 17, 32, 7, 14, 39, 66, 93, 8, 19, 52, 125, 134, 257, 10, 23, 57, 154, 318, 351, 378, 11, 27, 71, 194, 512, 639, 702, 471, 13, 29, 84, 216, 553, 1627, 1672, 789, 798, 15, 36, 98, 230, 594, 2141, 2168, 1747, 1960, 825, 16, 41, 111, 309
Offset: 1

Views

Author

Clark Kimberling, Dec 16 2024

Keywords

Comments

We begin with a definition of Type 1 runlength array, U(s), of a sequence s:
Suppose s is a sequence (finite or infinite), and define rows of U(s) as follows:
(row 0) = s
(row 1) = sequence of 1st terms of runs in (row 0); c(1) = complement of (row 1) in (row 0)
For n>=2,
(row n) = sequence of 1st terms of runs in c(n-1); c(n) = complement of (row n) in (row n-1),
where the process stops if and when c(n) is empty for some n.
***
The corresponding Type 1 runlength index array, UI(s) is now contructed from U(s) in two steps:
(1) Let U*(s) be the array obtaining by repeating the construction of U(s) using (n,s(n)) in place of s(n).
(2) Then UI(s) results by retaining only n in U*.
Thus, loosely speaking, (row n) of UI(s) shows the indices in s of the numbers in (row n) of U(s).
The array UI(s) includes every positive integer exactly once.

Examples

			Corner:
     1     2     4     6     7     8    10    11     13     15     16     18
     3     5     9    14    19    23    27    29     36     41     45     49
    12    17    39    52    57    71    84    98    111    116    139    161
    32    66   125   154   194   216   230   309    430    462    491    526
    93   134   318   512   553   594   943  1004   1330   1371   1594   1826
   257   351   639  1627  2141  2490  2612  2869   3501   3761   3990   4191
   378   702  1672  2168  2896  3564  3806  4017   4218   4935   5054   5418
   471   789  1747  2729  2905  3651  4547  6578   6763   7768   7962   8185
   798  1960  2756  2932  3660  4574  6659  6936   8368   9370  10296  12393
   825  1987  2783  3415  3687  4601  8455  9433  10359  12426  13180  15836
Starting with s = A000002, we have for U*(s):
(row 1) = ((1,1), (2,2), (4,1), (6,2), (7,1), (8,2), (10,1), (11,2), (13,1), ...)
c(1) = ((3,2), (5,1), (9,2), (12,2), (14,1), (17,1), (19,2), (23,1), (27,2), ...)
(row 2) = ((3,2), (5,1), (9,2), (14,1), (19,2), (23,1), (27,2), (29,1), (36,2), ...)
c(2) = ((12,2), (17,1), (32,1), (39,2), (52,1), (57,2), (66,2), (71,1), ...)
(row 3) = ((12,2), (17,1), (39,2), (52,1), (57,2), (71,1), ...)
so that UI(s) has
(row 1) = (1,2,4,6,7,8,10,11,13,...)
(row 2) = (3,5,9,14,19,...)
(row 3) = (12,17,32,66,...)
		

Crossrefs

Cf. A000002, A379047 (Type 2 array).

Programs

  • Mathematica
    r[seq_] := seq[[Flatten[Position[Prepend[Differences[seq[[All, 1]]], 1], _?(# != 0 &)]], 2]];  (* Type 1 *)
    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 *)
    row[0] = Transpose[{#, Range[Length[#]]}] &[row[0]];
    k = 0; Quiet[While[Head[row[k]] === List, row[k + 1] = row[0][[r[
         SortBy[Apply[Complement, Map[row[#] &, Range[0, k]]], #[[2]] &]]]]; k++]];
    m = Map[Map[#[[2]] &, row[#]] &, Range[k - 1]];
    p[n_] := Take[m[[n]], 12]
    t = Table[p[n], {n, 1, 12}]
    Grid[t]  (* array *)
    w[n_, k_] := t[[n]][[k]];
    Table[w[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten  (* sequence *)
    (* Peter J. C. Moses, Dec 04 2024 *)