A210530 T(n,k) = (k + 3*n - 2 - (k+n-2)*(-1)^(k+n))/2 n, k > 0, read by antidiagonals.
1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
Offset: 1
Examples
The start of the sequence as table: 1 2 1 4 1 6 1 8 1 10 3 2 5 2 7 2 9 2 11 2 3 6 3 8 3 10 3 12 3 14 7 4 9 4 11 4 13 4 15 4 5 10 5 12 5 14 5 16 5 18 11 6 13 6 15 6 17 6 19 6 7 14 7 16 7 18 7 20 7 22 15 8 17 8 19 8 21 8 23 8 9 18 9 20 9 22 9 24 9 26 19 10 21 10 23 10 25 10 27 10 ... The start of the sequence as triangle array read by rows: 1; 2, 3; 1, 2, 3; 4, 5, 6, 7; 1, 2, 3, 4, 5; 6, 7, 8, 9, 10, 11; 1, 2, 3, 4, 5, 6, 7; 8, 9, 10, 11, 12, 13, 14, 15; 1, 2, 3, 4, 5, 6, 7, 8, 9; 10, 11, 12, 13, 14, 15, 16, 17, 18, 19; ... Row number r contains r numbers. If r is odd: 1,2,3,...,r. If r is even: r, r+1, r+3, ..., 2*r-1. The start of the sequence as array read by rows, the length of row r is 4*r-1. First 2*r-1 numbers are from the row number 2*r-1 of triangle array, located above. Last 2*r numbers are from the row number 2*r of triangle array, located above. 1,2,3; 1,2,3,4,5,6,7; 1,2,3,4,5,6,7,8,9,10,11; 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15; 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19; ... Row number r contains 4*r-1 numbers: 1,2,3,...,4*r-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.
Programs
-
Mathematica
T[n_, k_] := (k+3n-2-(k+n-2)(-1)^(k+n))/2; Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Nov 17 2018 *)
-
PARI
T(n,k) = (k+3*n-2-(k+n-2)*(-1)^(k+n))/2; \\ Andrew Howroyd, Jan 11 2018
-
Python
t=int((math.sqrt(8*n-7)-1)/2) v=int((t+2)/2) result=n-v*(2*v-3)-1
Formula
As table T(n,k) = (k + 3*n - 2 - (k+n-2)*(-1)^(k+n))/2.
As linear sequence
a(n) = n - v*(2*v-3) - 1, where t = floor((-1 + sqrt(8*n-7))/2) and v = floor((t+2)/2).
G.f. of the table: (y*(- 1 + 3*y^2) + x^2*(2 + 5*y - 2*y^2 - 7*y^3) + x^3*(4 + y - 6*y^2 - y^3) + x*(y + 2*y^2 - y^3))/((- 1 + x)^2*(1 + x)^2*(-1 + y)^2*(1 + y)^2). - Stefano Spezia, Nov 17 2018
Comments