OFFSET
1,2
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.
***
Regarding the present array, each row of U(s) splits an increasing sequence of primes according to remainder modulo 3; e.g., in row 2, the remainders of primes in positions 10,12,16,19,24,37 are 2,1,2,1,2,1,2,1, respectively.
EXAMPLE
Corner:
1 2 3 4 6 8 10 11 12 14 16 17
5 7 9 13 15 25 28 30 32 45 47 51
20 26 39 60 76 79 92 113 118 123 132 136
23 71 93 137 156 187 230 260 283 296 318 326
48 80 94 140 157 198 233 265 286 343 377 382
49 89 95 199 236 268 472 595 635 702 732 755
96 204 241 271 473 600 642 841 899 956 1120 1279
133 356 512 601 643 844 906 961 1129 1402 1440 1482
242 457 549 869 921 962 1220 1403 1567 1910 1946 2097
243 460 566 870 1223 1406 1570 1917 1947 2102 2336 2655
248 991 1242 1483 1745 2103 2367 2664 2981 3322 3440 3953
249 992 1247 1484 1750 2118 2368 2667 3042 3323 3455 3956
Starting with s = A039702, we have for U*(s):
(row 1) = ((1,2), (2,3), (3,1), (4,3), (6,1), (8,3), (10,1), (11,3), ...)
c(1) = ((5,3), (7,1), (9,3), (13,1), (15,3), (20,3), (23,3), (25,1), (26,1), ...)
(row 2) = ((5,3), (7,1), (9,3), (13,1), (15,3), (25,1), (28,3), (30,1), (32,3), ...)
c(2) = (20,3), (23,3), (26,1), ...)
(row 3) = (20,3), (26,1), ...)
so that UI(s) has
(row 1) = (1,2,3,4,5,6,8,10,11, ...)
(row 2) = (5,7,9,13,15,25, ...)
(row 3) = (20,26,...)
MATHEMATICA
r[seq_] := seq[[Flatten[Position[Prepend[Differences[seq[[All, 1]]], 1], _?(# != 0 &)]], 2]];
row[0] = Mod[Prime[Range[4000]], 4]; (* A039702 *)
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]
w[n_, k_] := t[[n]][[k]];
Table[w[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten
(* Peter J. C. Moses, Dec 04 2024 *)
CROSSREFS
KEYWORD
tabl,nonn
AUTHOR
Clark Kimberling, Jan 15 2025.
STATUS
approved