cp's OEIS Frontend

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.

A210521 Array read by downward antidiagonals: T(n,k) = (n+k-1)*(n+k-2) + n + floor((n+k)/2)*(1-2*floor((n+k)/2)), for n, k > 0.

This page as a plain text file.
%I A210521 #45 Jun 02 2025 07:47:00
%S A210521 1,3,5,2,4,6,8,10,12,14,7,9,11,13,15,17,19,21,23,25,27,16,18,20,22,24,
%T A210521 26,28,30,32,34,36,38,40,42,44,29,31,33,35,37,39,41,43,45,47,49,51,53,
%U A210521 55,57,59,61,63,65,46,48,50,52,54,56,58,60,62,64,66,68
%N A210521 Array read by downward antidiagonals: T(n,k) = (n+k-1)*(n+k-2) + n + floor((n+k)/2)*(1-2*floor((n+k)/2)), for n, k > 0.
%C A210521 Enumeration table T(n,k). The order of the list: T(1,1)=1; for k>0: T(1,2*k+1),T(1,2*k); T(2,2*k),T(2,2*k-1); ... T(2*k,2),T(2*k,1); T(2*k+1,1).
%C A210521 The order of the list is descent stairs from the northeast to southwest: step to the west, step to the south, step to the west and so on. The length of each step is 1 or alternation of elements pair adjacent antidiagonals.
%C A210521 Permutation of the natural numbers.
%C A210521 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 A210521 Boris Putievskiy, <a href="/A210521/b210521.txt">Rows n = 1..140 of triangle, flattened</a>
%H A210521 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 A210521 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>
%H A210521 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A210521 As a table: T(n,k) = (n+k-1)*(n+k-2) + 2*n + floor((n+k)/2)*(1-2*floor((n+k)/2)).
%F A210521 As a linear sequence: a(n) = 2*A000027(n) + A204164(n)*(1-2*A204164(n)).
%F A210521 a(n) = 2*n+v*(1-2*v), where t = floor((-1+sqrt(8*n-7))/2) and v = floor((t+2)/2).
%F A210521 G.f. as a table: (2 - 2*y - 5*y^2 + 6*y^3 + 3*y^4 + x*y*(1 + 3*y-5*y^2 + y^3) + x^2*(- 3 + 7*y + 5*y^2 - 11*y^3 - 6*y^4) - x^3*(- 4 + 5*y + 7*y^2 - 9*y^3 + y^4) + x^4*(1 - y - 4*y^2 + y^3 + 7*y^4))/((- 1 + x)^3*(1 + x)^2*(- 1 + y)^3*(1 + y)^2). - _Stefano Spezia_, Dec 03 2018
%e A210521 The start of the sequence as a table:
%e A210521    1,  3,  2,  8,  7,  17,  16,  30,  29, ...
%e A210521    5,  4, 10,  9, 19,  18,  32,  31,  49, ...
%e A210521    6, 12, 11, 21, 20,  34,  33,  51,  50, ...
%e A210521   14, 13, 23, 22, 36,  35,  53,  52,  74, ...
%e A210521   15, 25, 24, 38, 37,  55,  54,  76,  75, ...
%e A210521   27, 26, 40, 39, 57,  56,  78,  77, 103, ...
%e A210521   28, 42, 41, 59, 58,  80,  79, 105, 104, ...
%e A210521   44, 43, 61, 60, 82,  81, 107, 106, 136, ...
%e A210521   45, 63, 62, 84, 83, 109, 108, 138, 137, ...
%e A210521   ...
%e A210521 The start of the sequence as a triangular array read by rows:
%e A210521    1;
%e A210521    3,  5;
%e A210521    2,  4,  6;
%e A210521    8, 10, 12, 14;
%e A210521    7,  9, 11, 13, 15;
%e A210521   17, 19, 21, 23, 25, 27;
%e A210521   16, 18, 20, 22, 24, 26, 28;
%e A210521   30, 32, 34, 36, 38, 40, 42, 44;
%e A210521   29, 31, 33, 35, 37, 39, 41, 43, 45;
%e A210521   ...
%e A210521 The sequence as array read by rows, the length of row r is 4*r-1. First 2*r-1 numbers are from row 2*r-1 of the triangular array above. Last 2*r numbers are from row 2*r of the triangular array. The start of the sequence:
%e A210521 1,3,5;
%e A210521 2,4,6,8,10,12,14;
%e A210521 7,9,11,13,15,17,19,21,23,25,27;
%e A210521 16,18,20,22,24,26,28,30,32,34,36,38,40,42,44;
%e A210521 29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65;
%e A210521 ...
%e A210521 Row r contains 4*r-1 numbers: 2*r^2-5*r+4, 2*r^2-5*r+6, 2*r^2-5*r+8, ..., r*(2*r+3).
%e A210521 Considered as a triangle, the rows have constant parity.
%t A210521 T[n_, k_] := (n+k-1)(n+k-2) + 2n + Floor[(n+k)/2](1 - 2 Floor[(n+k)/2]);
%t A210521 Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Dec 03 2018 *)
%o A210521 (Python)
%o A210521 t=int((math.sqrt(8*n-7)-1)/2)
%o A210521 v=int((t+2)/2)
%o A210521 result=2*n+v*(1-2*v)
%Y A210521 Cf. A000027, A204164, the main diagonal is A084849.
%K A210521 nonn,tabl
%O A210521 1,2
%A A210521 _Boris Putievskiy_, Jan 26 2013