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.

A213922 Natural numbers placed in table T(n,k) layer by layer. The order of placement: T(n,n), T(n-1,n), T(n,n-1), ... T(1,n), T(n,1). Table T(n,k) read by antidiagonals.

This page as a plain text file.
%I A213922 #21 Feb 16 2025 08:33:17
%S A213922 1,3,4,8,2,9,15,6,7,16,24,13,5,14,25,35,22,11,12,23,36,48,33,20,10,21,
%T A213922 34,49,63,46,31,18,19,32,47,64,80,61,44,29,17,30,45,62,81,99,78,59,42,
%U A213922 27,28,43,60,79,100,120,97,76,57,40,26,41,58,77,98,121
%N A213922 Natural numbers placed in table T(n,k) layer by layer. The order of placement: T(n,n), T(n-1,n), T(n,n-1), ... T(1,n), T(n,1). Table T(n,k) read by antidiagonals.
%C A213922 Permutation of the natural numbers.
%C A213922 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 A213922 Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). Enumeration table T(n,k) is layer by layer. The order of the list:
%C A213922 T(1,1)=1;
%C A213922 T(2,2), T(1,2), T(2,1);
%C A213922 ...
%C A213922 T(n,n), T(n-1,n), T(n,n-1), ... T(1,n), T(n,1);
%C A213922 ...
%H A213922 Boris Putievskiy, <a href="/A213922/b213922.txt">Rows n = 1..140 of triangle, flattened</a>
%H A213922 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 A213922 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>
%H A213922 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A213922 As a table,
%F A213922   T(n,k) = n*n - 2*k + 2, if n >= k;
%F A213922   T(n,k) = k*k - 2*n + 1, if n < k.
%F A213922 As a linear sequence,
%F A213922   a(n) = i*i - 2*j + 2, if i >= j;
%F A213922   a(n) = j*j - 2*i + 1, if i < j
%F A213922   where
%F A213922     i = n - t*(t+1)/2,
%F A213922     j = (t*t + 3*t + 4)/2 - n,
%F A213922     t = floor((-1 + sqrt(8*n-7))/2).
%e A213922 The start of the sequence as a table:
%e A213922    1,  3,  8, 15, 24, 35, ...
%e A213922    4,  2,  6, 13, 22, 33, ...
%e A213922    9,  7,  5, 11, 20, 31, ...
%e A213922   16, 14, 12, 10, 18, 29, ...
%e A213922   25, 23, 21, 19, 17, 27, ...
%e A213922   36, 34, 32, 30, 28, 26, ...
%e A213922 ...
%e A213922 The start of the sequence as triangular array read by rows:
%e A213922    1;
%e A213922    3,  4;
%e A213922    8,  2,  9;
%e A213922   15,  6,  7, 16;
%e A213922   24, 13,  5, 14, 25;
%e A213922   35, 22, 11, 12, 23, 36;
%e A213922   ...
%t A213922 f[n_, k_] := n^2 - 2*k + 2 /; n >= k; f[n_, k_] := k^2 - 2*n + 1 /; n < k; TableForm[Table[f[n, k], {n, 1, 5}, {k, 1, 10}]]; Table[f[n - k + 1, k], {n, 5}, {k, n, 1, -1}] // Flatten (* _G. C. Greubel_, Aug 19 2017 *)
%o A213922 (Python)
%o A213922 t=int((math.sqrt(8*n-7) - 1)/ 2)
%o A213922 i=n-t*(t+1)/2
%o A213922 j=(t*t+3*t+4)/2-n
%o A213922 if i >= j:
%o A213922    result=i*i-2*j+2
%o A213922 else:
%o A213922    result=j*j-2*i+1
%Y A213922 Cf. A060734, A060736; table T(n,k) contains: in rows A005563, A028872, A028875, A028881, A028560, A116711; in columns A000290, A008865, A028347, A028878, A028884.
%K A213922 nonn,tabl
%O A213922 1,2
%A A213922 _Boris Putievskiy_, Mar 05 2013