Additional information about A237265
For editorial reasons, some material concerning sequence A237265 has been moved here.
Recursive and iterative algorithms
Recursive algorithm for generating these matrices:
Let k be the number of elements to permute. Let A(k) be the k X k matrix with the answer.
(Begin) 0)If k=1 then A(k)=; 1.0) Else: 1.1) Get A(k-1), and rename it as B; 1.2) Copy the (k-1)^2 elements from B: A(k)[y,x]=B[y,x]; 1.3) Assign A(k)[i,k]=k for i in 1..(k-1); 1.4) Assign A(k)[k,j]=j-1 for j in 2..k; 1.5) Assign A(k)[k,1]=k; 2) Return A(k) (End)
Iterative algorithm for generating these matrices:
Let I(k) be the k X k identity matrix; Let A(k) be a k X k matrix referred to below simply as A;
(Begin) 0.a) Assign: A=I(k); 0.b) set j=2; (where j is a nonnegative integer) 0.c) set u=0; (where u is a nonnegative integer) 1) Assign: A[j,j]+u to A[j,j]; 2) Assign: A[j,j] for every element at the right in the same row; 3) Assign: (A[j,j]+1) to every element at the left in the same row; 4) Assign: (A[j,j]+1) to A[1,j]; 5) Increment: u++; 6) Increment: j++; 7) Repeat the steps from 1 to 6 while j<=k; 8) Transpose A; 9) Return A; (End)
Cite this page as
R. J. Cano, Additional information about A237265. — From the On-Line Encyclopedia of Integer Sequences® (OEIS®) wiki. (Available at https://oeis.org/wiki/Additional_information_about_A237265)