%I #11 Oct 16 2024 22:30:43
%S 1,4,5,3,6,2,13,12,14,11,15,10,16,9,17,8,18,7,30,29,31,28,32,27,33,26,
%T 34,25,35,24,36,23,37,22,38,21,39,20,40,19,58,59,57,60,56,61,55,62,54,
%U 63,53,64,52,65,51,66,50,67,49,68,48,69,47,70,46,71,45,72,44,73,43,74,42,75,41,101,102,100,103,99,104,98,105,97,106,96,107
%N Triangle read by rows (blocks). Each row consists of a permutation of the numbers of its constituents. The length of row number n is the n-th pentagonal number n(3n-1)/2 = A000326(n); see Comments.
%C A209278 presents an algorithm for generating permutations.
%C The sequence is an intra-block permutation of integer positive numbers.
%H Boris Putievskiy, <a href="/A376180/b376180.txt">Table of n, a(n) for n = 1..9126</a>
%H Boris Putievskiy, <a href="https://arxiv.org/abs/2310.18466">Integer Sequences: Irregular Arrays and Intra-Block Permutations</a>, arXiv:2310.18466 [math.CO], 2023.
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>.
%F Linear sequence:
%F a(n) = P(n) + (L(n)-1)^2*L(n)/2. a(n) = P(n) + A002411(L(n)-1), where P = (L(n)(3L(n) - 1)/2 - R(n) + 2)/2 if R(n) is odd and L(n)(3L(n) - 1)/2 is odd, P = (R(n) + L(n)(3L(n) - 1)/2 + 1)/2 if R(n) is odd and L(n)(3L(n) - 1)/2 is even, P = ceiling((L(n)(3L(n) - 1)/2 + 1)/2) + R(n)/2 if R(n) is even and L(n)(3L(n) - 1)/2 is odd, P = ceiling((L(n)(3L(n) - 1)/2 + 1)/2) - R(n)/2 if R(n) is even and L(n)(3L(n) - 1)/2 is even. L(n) = ceiling(x(n)), x(n) is largest real root of the equation x^2*(x+1)-2*n = 0.
%F Triangular array T(n,k) for 1 <= k <= n(3n-1)/2 (see Example):
%F T(n,k) = P(n,k) + (n-1)^2*n/2, T(n,k) = P(n,k) + A002411(n-1), where P(n,k) = (n(3n - 1)/2 - k + 2)/2 if k is odd and n(3n - 1)/2 is odd,
%F P(n,k) = (k + n(3n - 1)/2 + 1)/2 if k is odd and n(3n - 1)/2 is even, P(n,k) = ceiling((n(3n - 1)/2 + 1)/2) + k/2 if k is even and n(3n - 1)/2 is odd, P(n,k) = ceiling((n(3n - 1)/2 + 1)/2) - k/2 if k is even and n(3n - 1)/2 is even.
%e Triangle begins:
%e k = 1 2 3 4 5 6 7 8 9 10 11 12
%e n=1: 1;
%e n=2: 4, 5, 3, 6, 2;
%e n=3: 13, 12, 14, 11, 15, 10, 16, 9, 17, 8, 18, 7;
%e Subtracting (n-1)^2*n/2 from each term in row n is a permutation of 1 .. n(3n-1)/2:
%e 1;
%e 3,4,2,5,1;
%e 7,6,8,5,9,4,10,3,11,2,12,1;
%t a[n_]:=Module[{L,R,P,Result},L=Ceiling[Max[x/.NSolve[x^2 (x+1)-2 n==0,x,Reals]]];
%t R=n-((L-1)^2)*L/2; P=Which[OddQ[R]&&OddQ[L*(3*L-1)/2],(L*(3*L-1)/2-R+2)/2,OddQ[R]&&EvenQ[L*(3*L-1)/2],(R+L*(3*L-1)/2+1)/2,EvenQ[R]&&OddQ[L*(3*L-1)/2],Ceiling[(L*(3*L-1)/2+1)/2]+R/2, EvenQ[R]&&EvenQ[L*(3*L-1)/2],Ceiling[(L*(3*L-1)/2+1)/2]-R/2 ];
%t Result=P+(L-1)^2*L/2; Result]
%t Nmax=18; Table[a[n],{n,1,Nmax}]
%Y Cf. A000326, A002411, A209278, A375602.
%K nonn,tabf
%O 1,2
%A _Boris Putievskiy_, Sep 14 2024