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.

A221215 T(n,k)= ((n+k)^2-2*(n+k)+4-(n+3*k-2)*(-1)^(n+k))/2; n , k > 0, read by antidiagonals.

This page as a plain text file.
%I A221215 #36 Feb 16 2025 08:33:19
%S A221215 1,6,5,2,3,4,15,14,13,12,7,8,9,10,11,28,27,26,25,24,23,16,17,18,19,20,
%T A221215 21,22,45,44,43,42,41,40,39,38,29,30,31,32,33,34,35,36,37,66,65,64,63,
%U A221215 62,61,60,59,58,57,46,47,48,49,50,51,52,53,54,55,56,91
%N A221215 T(n,k)= ((n+k)^2-2*(n+k)+4-(n+3*k-2)*(-1)^(n+k))/2; n , k > 0, read by antidiagonals.
%C A221215 Permutation of the natural numbers.
%C A221215 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 A221215 Enumeration table T(n,k). Let m be natural number. The order of the list:
%C A221215 T(1,1)=1;
%C A221215 T(1,3), T(2,2), T(3,1);
%C A221215 T(2,1), T(1,2);
%C A221215 . . .
%C A221215 T(1,2*m+1), T(2,2*m), T(3,2*m-1), ... T(2*m+1,1);
%C A221215 T(2*m,1), T(2*m-1,2), T(2*m-2,3),...T(1,2*m);
%C A221215 . . .
%C A221215 First row  contains elements antidiagonal {T(1,2*m+1), ... T(2*m+1,1)}, read downwards.
%C A221215 second row contains elements antidiagonal {T(1,2*m), ... T(2*m,1)},  read upwards.
%C A221215 The same as A211394, except for reversed order in even diagonals. - _M. F. Hasler_, Feb 26 2013
%H A221215 Boris Putievskiy, <a href="/A221215/b221215.txt">Rows n = 1..140 of triangle, flattened</a>
%H A221215 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 A221215 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a>
%H A221215 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A221215 As table
%F A221215 T(n,k)= ((n+k)^2-2*(n+k)+4-(n+3*k-2)*(-1)^(n+k))/2.
%F A221215 As linear sequence
%F A221215 a(n) = (A003057(n)^2-2*A003057(n)+4-(A002260(n)+3*A004736(n)-2)*(-1)^A003056(n))/2;  a(n) = ((t+2)^2-2*(t+2)+4-(i+3*j-2)*(-1)^t)/2,
%F A221215 where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).
%e A221215 The start of the sequence as table:
%e A221215 1....6...2..15...7..28..16...
%e A221215 5....3..14...8..27..17..44...
%e A221215 4...13...9..26..18..43..31...
%e A221215 12..10..25..19..42..32..63...
%e A221215 11..24..20..41..33..62..50...
%e A221215 23..21..40..34..61..51..86...
%e A221215 22..39..35..60..52..85..73...
%e A221215 . . .
%e A221215 The start of the sequence as triangle array read by rows:
%e A221215 1;
%e A221215 6,5;
%e A221215 2,3,4;
%e A221215 15,14,13,12;
%e A221215 7,8,9,10,11;
%e A221215 28,27,26,25,24,23;
%e A221215 16,17,18,19,20,21,22;
%e A221215 . . .
%e A221215 Row number r contains r consecutive numbers.
%e A221215 If r is odd,  row is increasing.
%e A221215 If r is even, row is decreasing.
%t A221215 T[n_, k_] := ((n+k)^2 - 2(n+k) + 4 - (n+3k-2)(-1)^(n+k))/2;
%t A221215 Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Jan 05 2019 *)
%o A221215 (Python)
%o A221215 t=int((math.sqrt(8*n-7) - 1)/ 2)
%o A221215 i=n-t*(t+1)/2
%o A221215 j=(t*t+3*t+4)/2-n
%o A221215 result=((t+2)**2-2*(t+2)+4-(i+3*j-2)*(-1)**t)/2
%Y A221215 Cf. A211394, A002260, A004736, A003057.
%K A221215 nonn,tabl
%O A221215 1,2
%A A221215 _Boris Putievskiy_, Feb 22 2013