This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A188568 #50 Feb 16 2025 08:33:14 %S A188568 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 A188568 27,22,29,35,31,33,32,34,30,36,45,38,43,40,41,42,39,44,37,46,54,48,52, %U A188568 50,51,49,53,47,55 %N A188568 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 A188568 Self-inverse permutation of the natural numbers. %C A188568 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 A188568 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 A188568 Boris Putievskiy, <a href="/A188568/b188568.txt">Rows n = 1..140 of triangle, flattened</a> %H A188568 Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations Integer Sequences And Pairing Functions</a>, arXiv:1212.2732 [math.CO], 2012. %H A188568 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a> %H A188568 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A188568 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 A188568 The start of the sequence as table: %e A188568 1, 2, 6, 7, 15, 16, 28, ... %e A188568 3, 5, 9, 12, 20, 23, 35, ... %e A188568 4, 8, 13, 18, 26, 31, 43, ... %e A188568 10, 14, 19, 25, 33, 40, 52, ... %e A188568 11, 17, 24, 32, 41, 50, 62, ... %e A188568 21, 27, 34, 42, 51, 61, 73, ... %e A188568 22, 30, 39, 49, 60, 72, 85, ... %e A188568 ... %e A188568 The start of the sequence as triangular array read by rows: %e A188568 1; %e A188568 2, 3; %e A188568 6, 5, 4; %e A188568 7, 9, 8, 10; %e A188568 15, 12, 13, 14, 11; %e A188568 16, 20, 18, 19, 17, 21; %e A188568 28, 23, 26, 25, 24, 27, 22; %e A188568 ... %e A188568 Row number k contains permutation of the k numbers: %e A188568 { (k^2-k+2)/2, (k^2-k+2)/2 + 1, ..., (k^2+k-2)/2 + 1 }. %t A188568 a[n_] := Module[{t, i, j}, %t A188568 t = Floor[(Sqrt[8n-7]-1)/2]; %t A188568 i = n-t(t+1)/2; %t A188568 j = (t^2+3t+4)/2-n; %t A188568 ((i+j-1)(i+j-2) + ((-1)^Max[i,j]+1)i - ((-1)^Max[i,j]-1)j)/2]; %t A188568 Array[a, 55] (* _Jean-François Alcover_, Jan 26 2019 *) %o A188568 (Python) %o A188568 t=int((math.sqrt(8*n-7) - 1)/ 2) %o A188568 i=n-t*(t+1)/2 %o A188568 j=(t*t+3*t+4)/2-n %o A188568 m=((i+j-1)*(i+j-2)+((-1)**max(i,j)+1)*i-((-1)**max(i,j)-1)*j)/2 %Y A188568 Cf. A056011, A056023, A057027, A064578, A194981, A194982, inverse functions A208233, A208234, A194280, A064790. %K A188568 nonn,tabl %O A188568 1,2 %A A188568 _Boris Putievskiy_, Dec 27 2012