Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #34 Feb 15 2022 12:59:35
%S 1,2,3,5,4,6,9,7,8,10,14,12,11,13,15,20,18,16,17,19,21,27,25,23,22,24,
%T 26,28,35,33,31,29,30,32,34,36,44,42,40,38,37,39,41,43,45,54,52,50,48,
%U 46,47,49,51,53,55,65,63,61,59,57,56,58,60,62,64,66,77,75
%N Enumeration table T(n,k) by antidiagonals. The order of the list is symmetrical movement from center to edges diagonal.
%C The natural numbers are grouped in chunks of 1, 2, 3, 4,... as (1), (2,3), (4,5,6), (7,8,9,10), etc and each group fills a diagonal in the table. The smallest number in a group is in A000124, the largest in A000217. Numbers in a group are placed on free spots as close as possible to the middle of the diagonal, given preference to the smaller row numbers in the table if there is a draw.
%C The resulting array is apparently a transposed version of A064789 (if this was also written as an array).
%C The order of the list table T(n,k):
%C if n is odd:
%C T (floor(n+1)/2,floor(n+1)/2), T(floor(n+1)/2-1,floor(n+1)/2+1), T(floor(n+1)/2+1,floor(n+1)/2-1),...T(1,n), T(n,1)
%C if n is even:
%C T(floor(n+1)/2-1,floor(n+1)/2+1), T(floor(n+1)/2+1,floor(n+1)/2-1),...T(1,n), T(n,1).
%C 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.
%H Boris Putievskiy, <a href="/A185180/b185180.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'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 a(n) = (i*(i+1) + (j-1)*(j+2*i-4))/2, if j<=i, a(n)=(i*(i+1) + (j-1)*(j+2*i-4))/2 +2*(j-i)-1, if j>i, 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....5....9...14...20...27 ...
%e 3....4....7...12...18...25...33 ...
%e 6....8...11...16...23...31...40 ...
%e 10..13...17...22...29...38...48 ...
%e 15..19...24...30...37...46...57 ...
%e 21..26...32...39...47...56...67 ...
%e 28..34...41...49...58...68...79 ...
%e ...
%e The start of the sequence as triangle array read by rows:
%e 1;
%e 2, 3;
%e 5, 4, 6;
%e 9, 7, 8, 10;
%e 14, 12, 11, 13, 15;
%e 20, 18, 16, 17, 19, 21;
%e 27, 25, 23, 22, 24, 26, 28;
%e . . .
%e Row number k (k > 1) of the triangle contains a permutation of the set of k numbers from (k^2-k+2)/2, (k^2-k+2)/2 + 1 ,...up to (k^2+k-2)/2 + 1, namely (k^2+k-2)/2, (k^2+k-2)/2 -2,...,(k^2-k+2)/2, (k^2-k+2)/2 + 2,..., (k^2+k-2)/2-1, (k^2+k-2)/2+1.
%t a[n_] := Module[{i, j, t}, i = n - t(t+1)/2; j = (t^2 + 3t + 4)/2 - n; t = Floor[(-1 + Sqrt[8n - 7])/2]; If[j <= i, (i(i+1) + (j-1)(j + 2i - 4))/2, (i(i+1) + (j-1)(j + 2i - 4))/2 + 2(j-i) - 1]];
%t Array[a, 68] (* _Jean-François Alcover_, Nov 21 2018, from Python *)
%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 if j<=i:
%o m=(i*(i+1) + (j-1)*(j+2*i-4))/2
%o else:
%o m=(i*(i+1) + (j-1)*(j+2*i-4))/2 +2*(j-i)-1
%Y Cf. A056011, A056023, A057027, A057028, A064578, A194981, A194982, A188568.
%K nonn,tabl
%O 1,2
%A _Boris Putievskiy_, Dec 26 2012