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 A213197 #33 Feb 16 2025 08:33:17 %S A213197 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, %T A213197 26,25,30,31,33,34,36,37,39,40,29,45,32,44,35,43,38,42,41,47,48,50,51, %U A213197 53,54,56,57,59,60,46,66,49,65,52,64,55,63,58,62,61,68 %N 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. %C A213197 Permutation of the natural numbers. %C A213197 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 A213197 Enumeration table T(n,k). Let m be natural number. The order of the list: %C A213197 T(1,1)=1; %C A213197 T(3,1), T(2,2), T(1,3); %C A213197 T(2,1), T(1,2); %C A213197 ... %C A213197 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); %C A213197 T(2*m,2), T(2*m-2,4), ...T(2,2*m); %C A213197 ... %C A213197 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. %H A213197 Boris Putievskiy, <a href="/A213197/b213197.txt">Rows n = 1..140 of triangle, flattened</a> %H A213197 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 A213197 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a> %H A213197 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A213197 As a table: %F 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. %F A213197 As a linear sequence: %F A213197 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; %F A213197 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). %e A213197 The start of the sequence as a table: %e A213197 1, 3, 2, 8, 7, 17, 16, ... %e A213197 4, 6, 9, 15, 18, 28, 31, ... %e A213197 5, 11, 10, 20, 19, 33, 32, ... %e A213197 12, 14, 21, 27, 34, 44, 51, ... %e A213197 13, 23, 22, 36, 35, 53, 52, ... %e A213197 24, 26, 37, 43, 54, 64, 75, ... %e A213197 25, 39, 38, 56, 55, 77, 76, ... %e A213197 ... %e A213197 The start of the sequence as a triangular array read by rows: %e A213197 1; %e A213197 3, 4; %e A213197 2, 6, 5; %e A213197 8, 9, 11, 12; %e A213197 7, 15, 10, 14, 13; %e A213197 17, 18, 20, 21, 23, 24; %e A213197 16, 28, 19, 27, 22, 26, 25; %e A213197 ... %e A213197 The start of the sequence as an array read by rows, the length of row r is 4*r-3. %e A213197 First 2*r-2 numbers are from row 2*r-2 of the triangular array above. %e A213197 Last 2*r-1 numbers are from row 2*r-1 of the triangular array above. %e A213197 1; %e A213197 3, 4, 2, 6, 5; %e A213197 8, 9, 11, 12, 7, 15, 10, 14, 13; %e A213197 17, 18, 20, 21, 23, 24, 16, 28, 19, 27, 22, 26, 25; %e A213197 ... %e A213197 Row r contains permutation of 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r: %e A213197 2*r*r-5*r+5, 2*r*r-5*r+6, ..., 2*r*r-2*r+2, 2*r*r-2*r+1. %p A213197 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 %t A213197 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; %t A213197 Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Dec 06 2018 *) %o A213197 (Python) %o A213197 t=int((math.sqrt(8*n-7) - 1)/ 2) %o A213197 i=n-t*(t+1)/2 %o A213197 j=(t*t+3*t+4)/2-n %o A213197 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 %Y A213197 Cf. A002260, A004736, A003056, A003057. %Y A213197 Table T(n,k) contains: in rows A130883, A033816, A100037, A000384, A100038, A014106, A091823; in columns A001844, A142463, A090288, A139570, A046092, A051890, A059993, A097080, A181510, A137882, A152813. %K A213197 nonn,tabl %O A213197 1,2 %A A213197 _Boris Putievskiy_, Mar 01 2013