OFFSET
1,3
COMMENTS
Row m contains m distinct elements of the set {1..m}. The last element k(m) in row m becomes the first one in row m+1. There, the remaining elements of row m repeat in the same order, with element m+1 inserted immediately after that which is the k(m)-th in row m.
FORMULA
From Jon E. Schoenfield, Jul 17 2022: (Start)
T(1, 1) = 1.
For n > 1, let j = 2 + (T(n-1, n-1) mod (n-1)); then
T(n, k) = T(n-1, n-1) if k = 1
= T(n-1, k-1) if 1 < k < j
= n if k = j
= T(n-1, k-2) otherwise. (End)
Let b(n) = max(a(1),a(2),...,a(n)) then -(1/2) < 2^(1/2)*n^(1/2)-b(n) < (1/2). - Thomas Scheuerle, Jul 18 2022
EXAMPLE
Triangle begins
1;
1, 2;
2, 3, 1;
1, 2, 4, 3;
3, 1, 2, 4, 5;
5, 6, 3, 1, 2, 4;
4, 5, 6, 3, 1, 7, 2;
2, 4, 5, 8, 6, 3, 1, 7;
7, 2, 4, 5, 8, 6, 3, 1, 9;
9, 10, 7, 2, 4, 5, 8, 6, 3, 1;
1, 9, 11, 10, 7, 2, 4, 5, 8, 6, 3;
3, 1, 9, 11, 12, 10, 7, 2, 4, 5, 8, 6;
6, 3, 1, 9, 11, 12, 10, 13, 7, 2, 4, 5, 8;
...
To illustrate the rule:
Row 6 ends with 4, therefore the next row, row 7, begins with 4.
The order of the rest of the elements in row 6, that is, 5, 6, 3, 1, and 2, remains unchanged in row 7, while there the new element 7 is introduced immediately after 1 since the 4th element in row 6 is 1.
From Jon E. Schoenfield, Jul 17 2022: (Start)
The diagram below illustrates the way in which, on each row, each number from the previous row is placed either to the left or the right of the new number (which is identified by parentheses):
.
(1)
.
1 (2)
\
2 (3) 1
/ \
1 2 (4) 3
/ / /
3 1 2 4 (5)
\ \ \ \
5 (6) 3 1 2 4
/ / / / \
4 5 6 3 1 (7) 2
/ / \ \ \ \
2 4 5 (8) 6 3 1 7
/ / / / / / /
7 2 4 5 8 6 3 1 (9)
(End)
PROG
(MATLAB)
function a = A355792( max_row )
T = cell(1, 1); T{1} = 1;
for n = 2:max_row
j = mod(T{n-1}(end), n-1);
s = circshift(T{n-1}, 1, 2);
T{n} = [s(1:j+1) n s(j+2:end)];
end
a = [T{1:end}];
end % Thomas Scheuerle, Jul 18 2022
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Tamas Sandor Nagy, Jul 17 2022
STATUS
approved