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 A361642 #56 Mar 25 2023 13:21:16 %S A361642 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 A361642 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 A361642 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 A361642 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 A361642 The transformation process starts with an upwards column of numbers 1..n. %C A361642 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 A361642 Sliding steps continue until reaching a single row (all columns height 1), which is triangle row n. %C A361642 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 A361642 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 A361642 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 A361642 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 A361642 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 A361642 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 A361642 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 A361642 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 A361642 a(floor(((n+3)^2 - 2*n - 3)/2)) = 3, for n > 0. - _Thomas Scheuerle_, Mar 21 2023 %e A361642 Triangle T(n,k) begins: %e A361642 n/k | 1 2 3 4 5 6 7 %e A361642 ---------------------------- %e A361642 1 | 1; %e A361642 2 | 1, 2; %e A361642 3 | 1, 3, 2; %e A361642 4 | 1, 4, 3, 2; %e A361642 5 | 1, 5, 3, 4, 2; %e A361642 6 | 1, 6, 4, 3, 5, 2; %e A361642 7 | 1, 7, 4, 3, 5, 6, 2; %e A361642 ... %e A361642 . %e A361642 A few snapshots of the process for n = 7, a prime number: %e A361642 . %e A361642 7 %e A361642 6 %e A361642 5 %e A361642 4 4 %e A361642 3 3 5 3 5 3 %e A361642 2 2 6 2 6 2 6 5 2 6 5 %e A361642 1 1 7 1 7 4 1 7 4 1 7 4 3 1 7 4 3 5 6 2 %e A361642 . %e A361642 An example showing some stages of the process for a composite n = 6, with completed rectangles: %e A361642 . %e A361642 6 %e A361642 5 %e A361642 4 %e A361642 3 3 4 %e A361642 2 2 5 2 5 3 %e A361642 1 1 6 1 6 4 1 6 4 3 5 2 %e A361642 . %e A361642 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 A361642 . %e A361642 4 8 4 8 4 8 4 4 4 %e A361642 3 9 5 3 9 5 3 9 5 3 9 5 8 3 9 5 3 9 5 %e A361642 2 10 7 2 10 7 2 10 7 2 10 7 2 10 7 8 2 10 7 %e A361642 1 11 6 1 11 6 1 11 6 1 11 6 1 11 6 1 11 6 8 %o A361642 (MATLAB) %o A361642 function a = A361642( max_row ) %o A361642 a = 1; %o A361642 for r = 2:max_row %o A361642 p = [1:r]; %o A361642 for k = 2:r-1 %o A361642 j = [1:r]; %o A361642 t1 = find(mod(j,k) == 0); %o A361642 t2 = find(mod(j,k) ~= 0); %o A361642 j(t1) = [r:-1:r-length(t1)+1]; %o A361642 j(t2) = [1:length(t2)]; %o A361642 p = p(j); %o A361642 end %o A361642 a = [a p]; %o A361642 end %o A361642 end % _Thomas Scheuerle_, Mar 21 2023 %Y A361642 Cf. A002260, A002378, A000217 (row sums), A361660. %K A361642 nonn,tabl %O A361642 1,3 %A A361642 _Tamas Sandor Nagy_, Mar 19 2023