login
A211377
T(n,k) = ((k + n)^2 - 4*k + 3 + (-1)^k - (k + n - 2)*(-1)^(k + n))/2; n, k > 0, read by antidiagonals.
8
1, 3, 4, 2, 5, 6, 8, 9, 12, 13, 7, 10, 11, 14, 15, 17, 18, 21, 22, 25, 26, 16, 19, 20, 23, 24, 27, 28, 30, 31, 34, 35, 38, 39, 42, 43, 29, 32, 33, 36, 37, 40, 41, 44, 45, 47, 48, 51, 52, 55, 56, 59, 60, 63, 64, 46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 66, 68
OFFSET
1,2
COMMENTS
Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Enumeration table T(n,k). The order of the list:
T(1,1)=1;
T(1,3), T(1,2), T(2,1), T(2,2), T(3,1);
...
T(1,n), T(1,n-1), T(2,n-2), T(2,n-1), T(3,n-2), T(3,n-3)...T(n,1);
...
Descent by snake along two adjacent antidiagonal - step to the west, step to the southwest, step to the east, step to the southwest and so on. The length of each step is 1.
Table contains:
row 1 is alternation of elements A130883 and A033816,
row 2 accommodates elements A100037 in odd places;
column 1 is alternation of elements A000384 and A091823,
column 2 is alternation of elements A071355 and A014106,
column 3 accommodates elements A130861 in even places;
main diagonal accommodates elements A188135 in odd places,
diagonal 1, located above the main diagonal, is alternation of elements A033567 and A033566,
diagonal 2, located above the main diagonal, is alternation of elements A139271 and A033585.
FORMULA
As a table:
T(n,k) = ((k + n)^2 - 4*k + 3 + (-1)^k - (k + n - 2)*(-1)^(k + n))/2.
As a linear sequence:
a(n) = ((t + 2)^2 - 4*j + 3 + (-1)^j - t*(-1)^t)/2, where j = (t*t + 3*t + 4)/2 - n and t = int((sqrt(8*n - 7) - 1)/ 2).
EXAMPLE
The start of the sequence as a table:
1, 3, 2, 8, 7, 17, 16, 30, 29, 47, 46, ...
4, 5, 9, 10, 18, 19, 31, 32, 48, 49, 69, ...
6, 12, 11, 21, 20, 34, 33, 51, 50, 72, 71, ...
13, 14, 22, 23, 35, 36, 52, 53, 73, 74, 98, ...
15, 25, 24, 38, 37, 55, 54, 76, 75, 101, 100, ...
26, 27, 39, 40, 56, 57, 77, 78, 102, 103, 131, ...
28, 42, 41, 59, 58, 80, 79, 105, 104, 134, 133, ...
43, 44, 60, 61, 81, 82, 106, 107, 135, 136, 168, ...
45, 63, 62, 84, 83, 109, 108, 138, 137, 171, 170, ...
64, 65, 85, 86, 110, 111, 139, 140, 172, 173, 209, ...
66, 88, 87, 113, 112, 142, 141, 175, 174, 212, 211, ...
...
The start of the sequence as triangle array read by rows:
1;
3, 4;
2, 5, 6;
8, 9, 12, 13;
7, 10, 11, 14, 15;
17, 18, 21, 22, 25, 26;
16, 19, 20, 23, 24, 27, 28;
30, 31, 34, 35, 38, 39, 42, 43;
29, 32, 33, 36, 37, 40, 41, 44, 45;
47, 48, 51, 52, 55, 56, 59, 60, 63, 64;
46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 66;
...
The start of the sequence as an array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from row number 2*r-2 of the triangular array above.
Last 2*r-1 numbers are from row number 2*r-1 of the triangular array above.
1;
3, 4, 2, 5, 6;
8, 9, 12, 13, 7, 10, 11, 14, 15;
17, 18, 21, 22, 25, 26, 16, 19, 20, 23, 24, 27, 28;
30, 31, 34, 35, 38, 39, 42, 43, 29, 32, 33, 36, 37, 40, 41, 44, 45;
47, 48, 51, 52, 55, 56, 59, 60, 63, 64, 46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 66;
...
Row number r contains permutation 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r:
2*r*r-5*r+5, 2*r*r-5*r+6,...2*r*r-r-4, 2*r*r-r-1, 2*r*r-r.
MATHEMATICA
T[n_, k_] := ((k+n)^2 - 4k + 3 + (-1)^k - (k+n-2)(-1)^(k+n))/2;
Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Nov 29 2018 *)
PROG
(Python)
t=int((math.sqrt(8*n-7) - 1)/ 2)
i=n-t*(t+1)/2
j=(t*t+3*t+4)/2-n
result=((t+2)**2-4*j+3+(-1)**j-t*(-1)**(t+2))/2
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Feb 07 2013
STATUS
approved