OFFSET
1,2
COMMENTS
A209278 presents an algorithm for generating permutations.
The sequence is an intra-block permutation of integer positive numbers.
LINKS
Boris Putievskiy, Table of n, a(n) for n = 1..9126
Boris Putievskiy, Integer Sequences: Irregular Arrays and Intra-Block Permutations, arXiv:2310.18466 [math.CO], 2023.
FORMULA
Linear sequence:
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.
Triangular array T(n,k) for 1 <= k <= n(3n-1)/2 (see Example):
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,
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.
EXAMPLE
Triangle begins:
k = 1 2 3 4 5 6 7 8 9 10 11 12
n=1: 1;
n=2: 4, 5, 3, 6, 2;
n=3: 13, 12, 14, 11, 15, 10, 16, 9, 17, 8, 18, 7;
Subtracting (n-1)^2*n/2 from each term in row n is a permutation of 1 .. n(3n-1)/2:
1;
3,4,2,5,1;
7,6,8,5,9,4,10,3,11,2,12,1;
MATHEMATICA
a[n_]:=Module[{L, R, P, Result}, L=Ceiling[Max[x/.NSolve[x^2 (x+1)-2 n==0, x, Reals]]];
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 ];
Result=P+(L-1)^2*L/2; Result]
Nmax=18; Table[a[n], {n, 1, Nmax}]
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Boris Putievskiy, Sep 14 2024
STATUS
approved