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.

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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Tamas Sandor Nagy, Mar 19 2023

Keywords

Comments

The transformation process starts with an upwards column of numbers 1..n.
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.
Sliding steps continue until reaching a single row (all columns height 1), which is triangle row n.
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.
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.
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.
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.
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.
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.

Examples

			Triangle T(n,k) begins:
  n/k |  1  2  3  4  5  6  7
  ----------------------------
  1   |  1;
  2   |  1, 2;
  3   |  1, 3, 2;
  4   |  1, 4, 3, 2;
  5   |  1, 5, 3, 4, 2;
  6   |  1, 6, 4, 3, 5, 2;
  7   |  1, 7, 4, 3, 5, 6, 2;
 ...
.
A few snapshots of the process for n = 7, a prime number:
.
  7
  6
  5
  4    4
  3    3 5    3 5      3
  2    2 6    2 6      2 6 5    2 6 5
  1    1 7    1 7 4    1 7 4    1 7 4 3    1 7 4 3 5 6 2
.
An example showing some stages of the process for a composite n = 6, with completed rectangles:
.
  6
  5
  4
  3    3 4
  2    2 5    2 5 3
  1    1 6    1 6 4    1 6 4 3 5 2
.
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:
.
  4  8         4     8      4        8   4            4            4
  3  9  5      3  9  5      3  9  5      3  9  5  8   3  9  5      3  9  5
  2 10  7      2 10  7      2 10  7      2 10  7      2 10  7  8   2 10  7
  1 11  6      1 11  6      1 11  6      1 11  6      1 11  6      1 11  6  8
		

Crossrefs

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

Programs

  • MATLAB
    function a = A361642( max_row )
        a = 1;
        for r = 2:max_row
            p = [1:r];
            for k = 2:r-1
                j = [1:r];
                t1 = find(mod(j,k) == 0);
                t2 = find(mod(j,k) ~= 0);
                j(t1) = [r:-1:r-length(t1)+1];
                j(t2) = [1:length(t2)];
                p = p(j);
            end
            a = [a p];
        end
    end % Thomas Scheuerle, Mar 21 2023

Formula

a(floor(((n+3)^2 - 2*n - 3)/2)) = 3, for n > 0. - Thomas Scheuerle, Mar 21 2023