OFFSET
1,2
COMMENTS
Row T(n,k) for odd n is even numbers sandwiched between n's starts from n and 2*n.
Row T(n,k) for even n is odd numbers sandwiched between n's starts from 2*n-1 and n.
Antidiagonal T(1,k), T(2,k-1), ..., T(k,1) for odd k is 1,2,3,...,k.
Antidiagonal T(1,k), T(2,k-1), ..., T(k,1) for even k is k+1, k+2, ..., 2*k+1.
The main diagonal is A000027.
Diagonal, located above the main diagonal T(1,k), T(2,k+1), T(3,k+2), ... for odd k is A000027.
Diagonal, located above the main diagonal T(1,k), T(2,k+1), T(3,k+2), ... for even k is k, k+3, k+6, ..., A016789, A016777, A008585.
Diagonal, located below the main diagonal T(n,1), T(n+1,2), T(n+2,3), ... for odd n is n,n+1, n+2, ... A000027.
Diagonal, located below the main diagonal T(n,1), T(n+1,2), T(n+2,3), ... for even n is 2*n-1, 2*n+2, 2*n+5, ... A008585, A016777, A016789.
The table contains:
A124625 as row 1,
A114753 as column 1,
A109043 as column 2,
A066104 as column 4.
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.
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
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Jan 28 2013
STATUS
approved