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 A213171 #26 Feb 16 2025 08:33:17 %S A213171 1,4,5,2,3,6,9,10,13,14,7,8,11,12,15,18,19,22,23,26,27,16,17,20,21,24, %T A213171 25,28,31,32,35,36,39,40,43,44,29,30,33,34,37,38,41,42,45,48,49,52,53, %U A213171 56,57,60,61,64,65,46,47,50,51,54,55,58,59,62,63,66,69 %N A213171 T(n,k) = ((k+n)^2 - 4*k + 3 - (-1)^n - (k+n)*(-1)^(k+n))/2; n, k > 0, read by antidiagonals. %C A213171 Permutation of the natural numbers. %C A213171 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 A213171 Enumeration table T(n,k). The order of the list: %C A213171 T(1,1) = 1; %C A213171 T(1,3), T(2,2), T(1,2), T(2,1), T(3,1); %C A213171 . . . %C A213171 T(1,n), T(2,n-1), T(1,n-1), T(2,n-2), T(3,n-2), T(4,n-3)...T(n,1); %C A213171 ... %C A213171 Descent by snake along two adjacent antidiagonals - step to the southwest, step to the north, step to the southwest, step to the south and so on. The length of each step is 1. Phase four steps is rotated 90 degrees counterclockwise and the mirror of the phase A211377. %C A213171 Table contains the following: %C A213171 row 1 is alternation of elements A130883 and A100037, %C A213171 row 2 accommodates elements A033816 in even places; %C A213171 column 1 is alternation of elements A000384 and A014106, %C A213171 column 2 is alternation of elements A091823 and A071355, %C A213171 column 4 accommodates elements A130861 in odd places; %C A213171 main diagonal is alternation of elements A188135 and A033567, %C A213171 diagonal 1, located above the main diagonal, accommodates elements A033585 in even places, %C A213171 diagonal 2, located above the main diagonal, accommodates elements A139271 in odd places, %C A213171 diagonal 3, located above the main diagonal, is alternation of elements A033566 and A194431. %H A213171 Boris Putievskiy, <a href="/A213171/b213171.txt">Rows n = 1..140 of triangle, flattened</a> %H A213171 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 A213171 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a> %H A213171 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A213171 As a table: %F A213171 T(n,k) = ((k+n)^2-4*k+3-(-1)^n-(k+n)*(-1)^(k+n))/2. %F A213171 As a linear sequence: %F A213171 a(n) = (A003057(n)^2-4*A004736(n)+3-(-1)^A002260(n)-A003057(n)*(-1)^A003056(n))/2; %F A213171 a(n) = ((t+2)^2-4*j+3-(-1)^i-(t+2)*(-1)^t)/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 A213171 The start of the sequence as a table: %e A213171 1 4 2 9 7 8 16 ... %e A213171 5 3 10 8 19 17 32 ... %e A213171 6 13 11 22 20 35 33 ... %e A213171 14 12 23 21 36 34 53 ... %e A213171 15 26 24 39 37 56 54 ... %e A213171 27 25 40 38 57 55 78 ... %e A213171 28 43 41 60 58 81 79 ... %e A213171 ... %e A213171 The start of the sequence as a triangle array read by rows: %e A213171 1 %e A213171 4 5 %e A213171 2 3 6 %e A213171 9 10 13 14 %e A213171 7 8 11 12 15 %e A213171 18 19 22 23 26 27 %e A213171 16 17 20 21 24 25 28 %e A213171 ... %e A213171 The start of the sequence as array read by rows, the length of row r is 4*r-3. %e A213171 First 2*r-2 numbers are from the row number 2*r-2 of triangle array, located above. %e A213171 Last 2*r-1 numbers are from the row number 2*r-1 of triangle array, located above. %e A213171 1 %e A213171 4 5 2 3 6 %e A213171 9 10 13 14 7 8 11 12 15 %e A213171 18 19 22 23 26 27 16 17 20 21 24 25 28 %e A213171 ... %e A213171 Row number r contains permutation 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r: %e A213171 2*r*r-5*r+6, 2*r*r-5*r+7, ..., 2*r*r-r-4, 2*r*r-r-3, 2*r*r-r. %p A213171 T:=(n,k)->((k+n)^2-4*k+3-(-1)^n-(k+n)*(-1)^(k+n))/2: seq(seq(T(k,n-k),k=1..n-1),n=1..13); # _Muniru A Asiru_, Dec 06 2018 %t A213171 T[n_, k_] := ((n+k)^2 - 4k + 3 - (-1)^n - (-1)^(n+k)(n+k))/2; %t A213171 Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Dec 06 2018 *) %o A213171 (Python) %o A213171 t=int((math.sqrt(8*n-7) - 1)/ 2) %o A213171 i=n-t*(t+1)/2 %o A213171 j=(t*t+3*t+4)/2-n %o A213171 result=((t+2)**2-4*j+3-(-1)**i-(t+2)*(-1)**t)/2 %Y A213171 Cf. A000384, A002260, A003056, A003057, A004736, A014106, A033566, A033567, A033585, A033816, A071355, A091823, A100037, A130861, A130883, A139271, A188135, A194431, A211377. %K A213171 nonn,tabl %O A213171 1,2 %A A213171 _Boris Putievskiy_, Feb 14 2013