login
Triangle read by rows where row n is a self-inverse permutation of 1..n formed starting from a column 1..n and sliding numbers to the right and down.
3

%I #56 Mar 25 2023 13:21:16

%S 1,1,2,1,3,2,1,4,3,2,1,5,3,4,2,1,6,4,3,5,2,1,7,4,3,5,6,2,1,8,5,6,3,4,

%T 7,2,1,9,5,4,3,7,6,8,2,1,10,6,4,8,3,7,5,9,2,1,11,6,8,5,3,9,4,7,10,2,1,

%U 12,7,5,4,10,3,8,9,6,11,2,1,13,7,5,4,6,3,11,10,9,8,12,2,1,14,8,10,11,6,12,3,9,4,5,7,13,2

%N Triangle read by rows where row n is a self-inverse permutation of 1..n formed starting from a column 1..n and sliding numbers to the right and down.

%C The transformation process starts with an upwards column of numbers 1..n.

%C The rightmost number of the topmost row slides right across columns 1 smaller (if any), and then drops down either onto a 2 or more smaller final column if there is one, or otherwise starting a new final column.

%C Sliding steps continue until reaching a single row (all columns height 1), which is triangle row n.

%C The final move is always with 2 that slides rightward then one step down to the end of the resulting single row. 1 never moves.

%C The resulting row is a self-inverse permutation (involution) because the reverse steps are exactly those performed if the row is stood up as the starting column again.

%C In the case of transforming the column of a composite n, there will be instances when a number sliding sideways will drop down just one step as the changing stack becomes a complete rectangle of rows and columns. Such a number is always greater by 1 than the height of the completed rectangle, whose height and width are divisors of n.

%C The travel of a sliding number, other than 2, that thus completes a rectangle will continue: it immediately moves sideways again one step, then downwards. Those n's that are prime numbers will not have such number since their changing stack can never form a rectangle with divisors greater than 1, except themselves.

%C When performing the process in an orthogonal grid where the numbers slide sideways and downward in discrete steps, the total steps for n is an oblong number, the sequence of which is A002378.

%C In the orthogonal grid, in mid-process, the bounding box of the changing stack of numbers follows the n = x*y curve, and is in exact contact with it at integer x and y points where n is composite.

%H Thomas Scheuerle, <a href="/A361642/a361642.png">Numbers colored by absolute displacement.</a> Horizontally: row n of the triangle T(n, k). Vertically: k.

%H Thomas Scheuerle, <a href="/A361642/a361642_1.png">Numbers colored by value.</a> Horizontally: row n of the triangle T(n, k). Vertically: k.

%F a(floor(((n+3)^2 - 2*n - 3)/2)) = 3, for n > 0. - _Thomas Scheuerle_, Mar 21 2023

%e Triangle T(n,k) begins:

%e n/k | 1 2 3 4 5 6 7

%e ----------------------------

%e 1 | 1;

%e 2 | 1, 2;

%e 3 | 1, 3, 2;

%e 4 | 1, 4, 3, 2;

%e 5 | 1, 5, 3, 4, 2;

%e 6 | 1, 6, 4, 3, 5, 2;

%e 7 | 1, 7, 4, 3, 5, 6, 2;

%e ...

%e .

%e A few snapshots of the process for n = 7, a prime number:

%e .

%e 7

%e 6

%e 5

%e 4 4

%e 3 3 5 3 5 3

%e 2 2 6 2 6 2 6 5 2 6 5

%e 1 1 7 1 7 4 1 7 4 1 7 4 3 1 7 4 3 5 6 2

%e .

%e An example showing some stages of the process for a composite n = 6, with completed rectangles:

%e .

%e 6

%e 5

%e 4

%e 3 3 4

%e 2 2 5 2 5 3

%e 1 1 6 1 6 4 1 6 4 3 5 2

%e .

%e Step-by-step animation frames, showing 8, the rightmost number of the top row, sliding and dropping during its second movement, in the operation for n = 11:

%e .

%e 4 8 4 8 4 8 4 4 4

%e 3 9 5 3 9 5 3 9 5 3 9 5 8 3 9 5 3 9 5

%e 2 10 7 2 10 7 2 10 7 2 10 7 2 10 7 8 2 10 7

%e 1 11 6 1 11 6 1 11 6 1 11 6 1 11 6 1 11 6 8

%o (MATLAB)

%o function a = A361642( max_row )

%o a = 1;

%o for r = 2:max_row

%o p = [1:r];

%o for k = 2:r-1

%o j = [1:r];

%o t1 = find(mod(j,k) == 0);

%o t2 = find(mod(j,k) ~= 0);

%o j(t1) = [r:-1:r-length(t1)+1];

%o j(t2) = [1:length(t2)];

%o p = p(j);

%o end

%o a = [a p];

%o end

%o end % _Thomas Scheuerle_, Mar 21 2023

%Y Cf. A002260, A002378, A000217 (row sums), A361660.

%K nonn,tabl

%O 1,3

%A _Tamas Sandor Nagy_, Mar 19 2023