Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #49 Feb 15 2022 12:57:56
%S 1,2,3,6,5,4,7,9,8,10,15,12,13,14,11,16,20,18,19,17,21,28,23,26,25,24,
%T 27,22,29,35,31,33,32,34,30,36,45,38,43,40,41,42,39,44,37,46,54,48,52,
%U 50,51,49,53,47,55
%N Enumeration table T(n,k) by descending antidiagonals. The order of the list - if n is odd: T(n,1), T(2,n-1), T(n-2,3), ..., T(n-1,2), T(1,n); if n is even: T(1,n), T(n-1,2), T(3,n-2), ..., T(2,n-1), T(n,1).
%C Self-inverse permutation of the natural numbers.
%C 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.
%C Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). This table read layer by layer clockwise is A194280. This table read by boustrophedonic ("ox-plowing") method - layer clockwise, layer counterclockwise and so on - is A064790. - _Boris Putievskiy_, Mar 14 2013
%H Boris Putievskiy, <a href="/A188568/b188568.txt">Rows n = 1..140 of triangle, flattened</a>
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations Integer Sequences And Pairing Functions</a>, arXiv:1212.2732 [math.CO], 2012.
%H Eric W. Weisstein, <a href="http://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(n) = ((i+j-1)*(i+j-2)+((-1)^max(i,j)+1)*i-((-1)^max(i,j)-1)*j)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor[(-1+sqrt(8*n-7))/2].
%e The start of the sequence as table:
%e 1, 2, 6, 7, 15, 16, 28, ...
%e 3, 5, 9, 12, 20, 23, 35, ...
%e 4, 8, 13, 18, 26, 31, 43, ...
%e 10, 14, 19, 25, 33, 40, 52, ...
%e 11, 17, 24, 32, 41, 50, 62, ...
%e 21, 27, 34, 42, 51, 61, 73, ...
%e 22, 30, 39, 49, 60, 72, 85, ...
%e ...
%e The start of the sequence as triangular array read by rows:
%e 1;
%e 2, 3;
%e 6, 5, 4;
%e 7, 9, 8, 10;
%e 15, 12, 13, 14, 11;
%e 16, 20, 18, 19, 17, 21;
%e 28, 23, 26, 25, 24, 27, 22;
%e ...
%e Row number k contains permutation of the k numbers:
%e { (k^2-k+2)/2, (k^2-k+2)/2 + 1, ..., (k^2+k-2)/2 + 1 }.
%t a[n_] := Module[{t, i, j},
%t t = Floor[(Sqrt[8n-7]-1)/2];
%t i = n-t(t+1)/2;
%t j = (t^2+3t+4)/2-n;
%t ((i+j-1)(i+j-2) + ((-1)^Max[i,j]+1)i - ((-1)^Max[i,j]-1)j)/2];
%t Array[a, 55] (* _Jean-François Alcover_, Jan 26 2019 *)
%o (Python)
%o t=int((math.sqrt(8*n-7) - 1)/ 2)
%o i=n-t*(t+1)/2
%o j=(t*t+3*t+4)/2-n
%o m=((i+j-1)*(i+j-2)+((-1)**max(i,j)+1)*i-((-1)**max(i,j)-1)*j)/2
%Y Cf. A056011, A056023, A057027, A064578, A194981, A194982, inverse functions A208233, A208234, A194280, A064790.
%K nonn,tabl
%O 1,2
%A _Boris Putievskiy_, Dec 27 2012