A211394 T(n,k) = (k+n)*(k+n-1)/2-(k+n-1)*(-1)^(k+n)-k+2; n , k > 0, read by antidiagonals.
1, 5, 6, 2, 3, 4, 12, 13, 14, 15, 7, 8, 9, 10, 11, 23, 24, 25, 26, 27, 28, 16, 17, 18, 19, 20, 21, 22, 38, 39, 40, 41, 42, 43, 44, 45, 29, 30, 31, 32, 33, 34, 35, 36, 37, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 80
Offset: 1
Examples
The start of the sequence as table: 1....5...2..12...7..23..16... 6....3..13...8..24..17..39... 4...14...9..25..18..40..31... 15..10..26..19..41..32..60... 11..27..20..42..33..61..50... 28..21..43..34..62..51..85... 22..44..35..63..52..86..73... . . . The start of the sequence as triangle array read by rows: 1; 5,6; 2,3,4; 12,13,14,15; 7,8,9,10,11; 23,24,25,26,27,28; 16,17,18,19,20,21,22; . . . Row number r matches with r numbers segment {(r+1)*r/2-r*(-1)^(r+1)-r+2,... (r+1)*r/2-r*(-1)^(r+1)+1}.
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
- Eric Weisstein's World of Mathematics, Pairing functions
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Cf. A130883, A096376, A033816, A100037, A100038, A084849, A000384, A014106, A014105, A014107, A091823, A071355, A168244, A033537, A100040, A130861, A100041, A058331, A001844, A001105, A046092, A056220, A142463, A054000, A090288, A059993, A147973, A139570, A051890, A005893, A097080, A093328, A137882.
Programs
-
Mathematica
T[n_, k_] := (n+k)(n+k-1)/2 - (-1)^(n+k)(n+k-1) - k + 2; Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Dec 06 2018 *)
-
Python
t=int((math.sqrt(8*n-7) - 1)/ 2) j=(t*t+3*t+4)/2-n result=(t+2)*(t+1)/2-(t+1)*(-1)**t-j+2
Comments