%I #21 Nov 29 2023 06:57:49
%S 1,2,3,5,4,6,8,9,7,10,13,12,14,11,15,18,19,17,20,16,21,25,24,26,23,27,
%T 22,28,32,33,31,34,30,35,29,36,41,40,42,39,43,38,44,37,45,50,51,49,52,
%U 48,53,47,54,46,55,61,60,62,59,63,58,64,57,65,56,66,72,73,71,74,70,75,69,76,68,77,67
%N Inverse permutation of A185180.
%C 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.
%C Enumeration table T(n,k) by diagonals. The order of the list
%C if n is odd - T(n-1,2),T(n-3,4),...,T(2,n-1),T(1,n),T(3,n-2),...T(n,1).
%C if n is even - T(n-1,2),T(n-3,4),...,T(3,n-2),T(1,n),T(2,n-1),...T(n,1).
%C Table T(n,k) contains:
%C Column number 1 A000217,
%C column number 2 A000124,
%C column number 3 A000096,
%C column number 4 A152948,
%C column number 5 A034856,
%C column number 6 A152950,
%C column number 7 A055998.
%C Row numder 1 A000982,
%C row number 2 A097063.
%H Boris Putievskiy, <a href="/A209293/b209293.txt">Rows n = 1..140 of triangle, flattened</a>
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [of] Integer Sequences And Pairing Functions</a> arXiv:1212.2732 [math.CO], 2012.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F As table T(n,k) read by antidiagonals
%F T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
%F As linear sequence
%F a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where
%F m1 = int((i+j)/2)+int(i/2)*(-1)^(i+t+1),
%F m2 = int((i+j+1)/2)+int(i/2)*(-1)^(i+t),
%F t = int((math.sqrt(8*n-7) - 1)/ 2),
%F i = n-t*(t+1)/2,
%F j = (t*t+3*t+4)/2-n.
%e The start of the sequence as table:
%e 1....2...5...8..13..18...25...32...41...
%e 3....4...9..12..19..24...33...40...51...
%e 6....7..14..17..26..31...42...49...62...
%e 10..11..20..23..34..39...52...59...74...
%e 15..16..27..30..43..48...63...70...87...
%e 21..22..35..38..53..58...75...82..101...
%e 28..29..44..47..64..69...88...95..116...
%e 36..37..54..57..76..81..102..109..132...
%e 45..46..65..68..89..94..117..124..149...
%e . . .
%e The start of the sequence as triangle array read by rows:
%e 1;
%e 2,3;
%e 5,4,6;
%e 8,9,7,10;
%e 13,12,14,11,15;
%e 18,19,17,20,16,21;
%e 25,24,26,23,27,22,28;
%e 32,33,31,34,30,35,29,36;
%e 41,40,42,39,43,38,44,37,45;
%e . . .
%e Row number r contains permutation from r numbers:
%e if r is odd ceiling(r^2/2), ceiling(r^2/2)+1, ceiling(r^2/2)-1, ceiling(r^2/2)+2, ceiling(r^2/2)-2,...r*(r+1)/2;
%e if r is even ceiling(r^2/2), ceiling(r^2/2)-1, ceiling(r^2/2)+1, ceiling(r^2/2)-2, ceiling(r^2/2)+2,...r*(r+1)/2;
%t max = 10; row[n_] := Table[Ceiling[(n + k - 1)^2/2] + If[OddQ[k], 1, -1]*Floor[n/2], {k, 1, max}]; t = Table[row[n], {n, 1, max}]; Table[t[[n - k + 1, k]], {n, 1, max}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Jan 17 2013 *)
%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 m1=int((i+j)/2)+int(i/2)*(-1)**(i+t+1)
%o m2=int((i+j+1)/2)+int(i/2)*(-1)**(i+t)
%o m=(m1+m2-1)*(m1+m2-2)/2+m1
%Y Cf. A000217, A000124, A000096, A152948, A034856, A152950, A055998, A000982, A097063.
%K nonn,tabl
%O 1,2
%A _Boris Putievskiy_, Jan 16 2013