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.

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

This page as a plain text file.
%I A218890 #56 Feb 16 2025 08:33:18
%S A218890 1,2,3,6,5,4,10,9,8,7,11,12,13,14,15,16,17,18,19,20,21,28,27,26,25,24,
%T A218890 23,22,36,35,34,33,32,31,30,29,37,38,39,40,41,42,43,44,45,46,47,48,49,
%U A218890 50,51,52,53,54,55,66,65,64,63,62,61,60,59,58,57,56,78
%N A218890 T(n,k) = ((n + k - 1)*(n + k - 2) - (-1 + (-1)^floor((n + k)/2))*n + (1 +(-1)^floor((n + k)/2))*k)/2; n , k > 0, read by antidiagonals.
%C A218890 Self-inverse permutation of the natural numbers.
%C A218890 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 A218890 In general, let m be natural number. Natural numbers placed in table T(n,k) by antidiagonals. The order of placement - at the beginning m antidiagonals downwards, next m antidiagonals upwards and so on. T(n,k) read by antidiagonals downwards.
%C A218890 For m = 1 the result is A056011. This sequence is result for m = 2.
%C A218890 A056023 is result for m = 1 and the changed order of placement - at the beginning m antidiagonals upwards, next m antidiagonals downwards and so on.
%H A218890 Boris Putievskiy, <a href="/A218890/b218890.txt">Rows n = 1..140 of triangle, flattened</a>
%H A218890 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 A218890 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>
%H A218890 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A218890 For the general case.
%F A218890 As a table
%F A218890 T(n,k) = ((n + k - 1)*(n + k - 2) - (-1 + (-1)^floor((n + k + m - 2)/m))*n + (1 +(-1)^floor((n + k + m - 2)/m))*k)/2.
%F A218890 As linear sequence
%F A218890 a(n) = ((z - 1)*(z - 2) - (-1 + (-1)^floor((z + m - 2)/m))*i + (1 + (-1)^floor((z + m - 2)/m))*j)/2, where i = n - t*(t + 1)/2, j = (t*t + 3*t + 4)/2 - n, t = floor((-1 + sqrt(8*n - 7))/2), z = i + j.
%F A218890 If we change the order of placement - m antidiagonals upwards, m antidiagonals downwards and so on.
%F A218890 As a table
%F A218890 T(n,k) = ((n + k - 1)*(n + k - 2) - (-1 + (-1)^(floor((n + k + m - 2)/m) + 1))*n + (1 + (-1)^(floor((n + k + m - 2)/m) + 1))*k)/2.
%F A218890 As linear sequence
%F A218890 a(n) = ((z - 1)*(z - 2) - (-1 + (-1)^(floor((z + m - 2)/m) + 1))*i + (1 + (-1)^(floor((z + m - 2)/m) + 1))*j)/2, where i = n - t*(t + 1)/2, j = (t*t + 3*t + 4)/2 - n, t = floor((-1 + sqrt(8*n - 7))/2), z = i + j.
%F A218890 For this sequence.
%F A218890 As a table
%F A218890 T(n,k) = ((n + k - 1)*(n + k - 2) - (-1 +(-1)^floor((n + k)/2))*n + (1 + (-1)^floor((n + k)/2))*k)/2.
%F A218890 As linear sequence
%F A218890 a(n) = ((z - 1)*(z - 2) - (-1 + (-1)^floor(z/2))*i + (1 + (-1)^floor(z/2))*j)/2, where i = n - t*(t + 1)/2, j = (t*t + 3*t + 4)/2 - n, t = floor((-1 + sqrt(8*n - 7))/2), z = i + j.
%e A218890 The start of the sequence as table.  The direction of the placement denotes by ">" and  "v".
%e A218890   v...v          v...v
%e A218890 ..1...2...6..10..11..16..28..36...
%e A218890 ..3...5...9..12..17..27..35..38...
%e A218890 > 4...8..13..18..26..34..39..48...
%e A218890 > 7..14..19..25..33..40..49..63...
%e A218890 .15..20..24..32..41..50..62..74...
%e A218890 .21..23..31..42..51..61..73..84...
%e A218890 >22..30..43..52..60..72..85..98...
%e A218890 >29..44..53..59..71..86..99.113...
%e A218890   . . .
%e A218890 The start of the sequence as triangle array read by rows:
%e A218890    1;
%e A218890    2,  3;
%e A218890    6,  5,  4;
%e A218890   10,  9,  8,  7;
%e A218890   11, 12, 13, 14, 15;
%e A218890   16, 17, 18, 19, 20, 21;
%e A218890   28, 27, 26, 25, 24, 23, 22;
%e A218890   36, 35, 34, 33, 32, 31, 30, 29;
%e A218890   ...
%e A218890 Row r consists of r consecutive numbers from r*r/2 - r/2 + 1 to r*r/2 + r.
%e A218890 If r congruent to 1 or 2 mod 4 rows are increasing.
%e A218890 If r congruent to 0 or 3 mod 4 rows are decreasing.
%p A218890 T:=(n,k)->((n+k-1)*(n+k-2)-(-1+(-1)^floor((n+k)/2))*n+(1+(-1)^floor((n+k)/2))*k)/2: seq(seq(T(k,n-k),k=1..n-1),n=1..13); # _Muniru A Asiru_, Dec 13 2018
%t A218890 T[n_, k_] := ((n+k-1)(n+k-2) - (-1 + (-1)^Floor[(n+k)/2])n + (1 + (-1)^Floor[(n+k)/2]) k)/2;
%t A218890 Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* _Jean-François Alcover_, Dec 06 2018 *)
%o A218890 (Python)
%o A218890 t=int((math.sqrt(8*n-7) - 1)/ 2)
%o A218890 i=n-t*(t+1)/2
%o A218890 j=(t*t+3*t+4)/2-n
%o A218890 z=i+j
%o A218890 result=((z-1)*(z-2)-(-1+(-1)**int(z/2))*i+(1+(-1)**int(z/2))*j)/2
%o A218890 (Maxima) T(n,k) = ((n + k - 1)*(n + k - 2) - (-1 + (-1)^floor((n + k)/2))*n + (1 +(-1)^floor((n + k)/2))*k)/2$
%o A218890 create_list(T(k, n - k), n, 1, 12, k, 1, n - 1); /* _Franck Maminirina Ramaharo_, Dec 13 2018 */
%Y A218890 Cf. A056011, A056023.
%K A218890 nonn,tabl
%O A218890 1,2
%A A218890 _Boris Putievskiy_, Feb 19 2013