login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A213197 T(n,k) = (2*(n+k)^2 - 2*(n+k) - 4*k + 6 + (2*k-2)*(-1)^n + (2*k-1)*(-1)^k + (-2*n+1)*(-1)^(n+k))/4; n, k > 0, read by antidiagonals. 4
1, 3, 4, 2, 6, 5, 8, 9, 11, 12, 7, 15, 10, 14, 13, 17, 18, 20, 21, 23, 24, 16, 28, 19, 27, 22, 26, 25, 30, 31, 33, 34, 36, 37, 39, 40, 29, 45, 32, 44, 35, 43, 38, 42, 41, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 46, 66, 49, 65, 52, 64, 55, 63, 58, 62, 61, 68 (list; table; graph; refs; listen; history; text; internal format)
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). Let m be natural number. The order of the list:
T(1,1)=1;
T(3,1), T(2,2), T(1,3);
T(2,1), T(1,2);
...
T(1,2*m+1), T(1,2*m), T(2, 2*m-1), T(3, 2*m-1),... T(2*m,1), T(2*m+1,1);
T(2*m,2), T(2*m-2,4), ...T(2,2*m);
...
Movement along two adjacent antidiagonals. The first row consists of phases: step to the west, step to the southwest, step to the south. The second row consists of phases: 2 steps to the north, 2 steps to the east. The length of each step is 1.
LINKS
Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
Eric Weisstein's World of Mathematics, Pairing functions
FORMULA
As a table:
T(n,k) = (2*(n+k)^2 - 2*(n+k) - 4*k + 6 + (2*k-2)*(-1)^n + (2*k-1)*(-1)^k + (-2*n+1)*(-1)^(n+k))/4.
As a linear sequence:
a(n) = (2*A003057(n)^2 - 2*A003057(n) - 4*A004736(n) + 6 + (2*A004736(n)-2)*(-1)^A002260(n) + (2*A004736(n)-1)*(-1)^A004736(n) + (-2*A002260(n)+1)*(-1)^A003056(n))/4;
a(n) = (2*(t+2)^2 - 2*(t+2) - 4*j + 6 + (2*j-2)*(-1)^i + (2*j-1)*(-1)^j + (-2*i+1)*(-1)^t)/4, where i = n - t*(t+1)/2, j = (t*t + 3*t + 4)/2 - n, t = floor((-1+sqrt(8*n-7))/2).
EXAMPLE
The start of the sequence as a table:
1, 3, 2, 8, 7, 17, 16, ...
4, 6, 9, 15, 18, 28, 31, ...
5, 11, 10, 20, 19, 33, 32, ...
12, 14, 21, 27, 34, 44, 51, ...
13, 23, 22, 36, 35, 53, 52, ...
24, 26, 37, 43, 54, 64, 75, ...
25, 39, 38, 56, 55, 77, 76, ...
...
The start of the sequence as a triangular array read by rows:
1;
3, 4;
2, 6, 5;
8, 9, 11, 12;
7, 15, 10, 14, 13;
17, 18, 20, 21, 23, 24;
16, 28, 19, 27, 22, 26, 25;
...
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 2*r-2 of the triangular array above.
Last 2*r-1 numbers are from row 2*r-1 of the triangular array above.
1;
3, 4, 2, 6, 5;
8, 9, 11, 12, 7, 15, 10, 14, 13;
17, 18, 20, 21, 23, 24, 16, 28, 19, 27, 22, 26, 25;
...
Row r contains permutation of 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-2*r+2, 2*r*r-2*r+1.
MAPLE
T:=(n, k)->(2*(n+k)^2-2*(n+k)-4*k+6+(2*k-2)*(-1)^n+(2*k-1)*(-1)^k+(1-+2*n)*(-1)^(n+k))/4: seq(seq(T(k, n-k), k=1..n-1), n=1..13); # Muniru A Asiru, Dec 06 2018
MATHEMATICA
T[n_, k_] := (2(n+k)^2 - 2(n+k) - 4k + 6 + (2k-2)(-1)^n + (2k-1)(-1)^k + (-2n+1)(-1)^(n+k))/4;
Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Dec 06 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=(2*(t+2)**2-2*(t+2)-4*j+6 +(2*j-2)*(-1)**i+(2*j-1)*(-1)**j+(-2*i+1)*(-1)**t)/4
CROSSREFS
Sequence in context: A247413 A108127 A207376 * A049277 A214917 A260316
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Mar 01 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 09:22 EDT 2024. Contains 371905 sequences. (Running on oeis4.)