login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A209302
Table T(n,k) = max{n+k-1, n+k-1} n, k > 0, read by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1).
2
1, 2, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 16, 15, 14
OFFSET
1,2
LINKS
Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
FORMULA
In general, let m be a natural number. Table T(n,k) = max{m*n+k-m, n+m*k-m}. For the general case,
a(n) = (m+1)*sqrt(n-1) + 1 - |n - floor(sqrt(n-1))^2 - floor(sqrt(n-1))|.
For m=1,
a(n) = 2*sqrt(n-1) + 1 - |n - floor(sqrt(n-1))^2 - floor(sqrt(n-1))|.
a(n) = t + |t^2 - n|, where t = floor(sqrt(n)+1/2). - Ridouane Oudra, May 07 2019
EXAMPLE
The start of the sequence as a table for the general case:
1 m+1 2*m+1 3*m+1 4*m+1 5*m+1 6*m+1 ...
m+1 m+2 2*m+2 3*m+2 4*m+2 5*m+2 6*m+2 ...
2*m+1 2*m+2 2*m+3 3*m+3 4*m+3 5*m+3 6*m+3 ...
3*m+1 3*m+2 3*m+3 3*m+4 4*m+4 5*m+4 6*m+4 ...
4*m+1 4*m+2 4*m+3 4*m+4 4*m+5 5*m+5 6*m+5 ...
5*m+1 5*m+2 5*m+3 5*m+4 5*m+5 5*m+6 6*m+6 ...
6*m+1 6*m+2 6*m+3 6*m+4 6*m+5 6*m+6 6*m+7 ...
...
The start of the sequence as a triangular array read by rows for general case:
1;
m+1, m+2, m+1;
2*m+1, 2*m+2, 2*m+3, 2*m+2, 2*m+1;
3*m+1, 3*m+2, 3*m+3, 3*m+4, 3*m+3, 3*m+2, 3*m+1;
4*m+1, 4*m+2, 4*m+3, 4*m+4, 4*m+5, 4*m+4, 4*m+3, 4*m+2, 4*m+1;
...
Row r contains 2*r-1 terms: r*m+1, r*m+2, ... r*m+r, r*m+r+1, r*m+r, ..., r*m+2, r*m+1.
The start of the sequence as triangle array read by rows for m=1:
1;
2, 3, 2;
3, 4, 5, 4, 3;
4, 5, 6, 7, 6, 5, 4;
5, 6, 7, 8, 9, 8, 7, 6, 5;
6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6;
7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7;
...
PROG
(Python)
result = 2*int(math.sqrt(n-1)) - abs(n-int(math.sqrt(n-1))**2 - int(math.sqrt(n-1)) -1) +1
CROSSREFS
Cf. A187760.
Sequence in context: A064672 A138554 A063772 * A205122 A174863 A064289
KEYWORD
nonn,tabf
AUTHOR
Boris Putievskiy, Jan 18 2013
STATUS
approved