A377137 Array read by rows (blocks). Each row is a permutation of a block of consecutive numbers; the blocks are disjoint and every positive number belongs to some block. Row n contains 3n/2 elements if n is even, and (n+1)/2 elements if n is odd; ; see Comments.
1, 4, 2, 3, 6, 5, 12, 10, 8, 7, 9, 11, 15, 13, 14, 24, 22, 20, 18, 16, 17, 19, 21, 23, 28, 26, 25, 27, 40, 38, 36, 34, 32, 30, 29, 31, 33, 35, 37, 39, 45, 43, 41, 42, 44, 60, 58, 56, 54, 52, 50, 48, 46, 47, 49, 51, 53, 55, 57, 59, 66, 64, 62, 61, 63, 65, 84, 82, 80, 78, 76, 74, 72, 70, 68, 67, 69, 71, 73, 75, 77, 79, 81, 83, 91, 89, 87, 85, 86
Offset: 1
Examples
Array begins: k = 1 2 3 4 5 6 n=1: 1; n=2: 4, 2, 3; n=3: 6, 5; n=4: 12, 10, 8, 7, 9, 11; The triangular arrays alternate by row: n=1 and n=3 comprise one, and n=2 and n=4 comprise the other. Subtracting (n^2 - 1)/2 if n is odd from each term in row n produces a permutation of 1 .. (n+1)/2. Subtracting (n^2 - n)/2 if n is even from each term in row n produces a permutation of 1 .. 3n/2: 1, 3, 1, 2, 2, 1, 6, 4, 2, 1, 3, 5, ...
Links
- Boris Putievskiy, Table of n, a(n) for n = 1..9940
- Boris Putievskiy, Integer Sequences: Irregular Arrays and Intra-Block Permutations, arXiv:2310.18466 [math.CO], 2023.
- Index entries for sequences that are permutations of the natural numbers.
Programs
-
Mathematica
a[n_]:=Module[{L,R, P,Result},L=Ceiling[Max[x/.NSolve[x*(2*(x-1)-Cos[Pi*(x-1)]+5)-4*n==0,x,Reals]]]; R=n-If[EvenQ[L],(L^2-L)/2,(L^2-1)/2]; P[(L+1)*(2*L-(-1)^L+5)/4]=If[EvenQ[L],3L/2,(L+1)/2]; P[3]=2; P= Abs[2*R-If[EvenQ[L],3L/2,(L+1)/2]-If[2*R<=If[EvenQ[L],3L/2,(L+1)/2]+1,2,1]]; Res=P+If[EvenQ[L],(L^2-L)/2,(L^2-1)/2]; Result=Res; Result] Nmax= 12; Table[a[n],{n,1,Nmax}]
Formula
Linear sequence:
a(n) = P(n) + B(L(n)-1), where L(n) = ceiling(x(n)), x(n) is largest real root of the equation B(x) - n = 0. B(n) = (n+1)*(2*n-(-1)^n+5)/4 = A265225(n). P(n) = A162630(n)/2.
Array T(n,k) (see Example):
T(n, k) = P(n, k) + (n^2 - n)/2 if n is even, T(n, k) = P(n, k) + (n^2 - 1)/2 if n is odd, T(n, k) = P(n, k) + A265225(n-1). P(n, k) = |2k - 3n / 2 - 2| if n is even and if 2k <= 3n / 2 + 1, P(n, k) = |2k - 3n / 2 - 1| if n is even and if 2k > 3n / 2 + 1. P(n, k) = |2k - (n + 1) / 2 - 2| if n is odd and if 2k <= (n + 1) / 2 + 1, P(n, k) = |2k - (n + 1) / 2 - 1| if n is odd and if 2k > (n + 1) / 2 + 1. There are several special cases: P(n, 1) = 3n/2 if n is even, P(n, 1) = (n+1)/2 if n is odd. P(2, 2) = 1. P(n, n) = n/2 - 1 if n is even, P(n, n) = (n-3)/2 if n is odd.
Comments