OFFSET
1,2
COMMENTS
A simple permutation of natural numbers.
Parity of the sequence is given by A057211 (n-th run has length n). - Jeremy Gardiner, Dec 26 2008
The square with corners T(1,1)=1 and T(n,n)=n^2-n+1 is occupied by the numbers 1,2,...,n^2. - Clark Kimberling, Feb 01 2011
a(n) is pairing function - function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} - the set of integer positive numbers. - Boris Putievskiy, Dec 17 2012
LINKS
Alois P. Heinz, Rows n = 1..141 of triangle, flattened
Boris Putievskiy, Transformations Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
Eric W. Weisstein, MathWorld: Pairing functions
FORMULA
T(n,k) = (n-1)^2+k, T(k, n)=n^2+1-k, 1 <= k <= n.
From Clark Kimberling, Feb 01 2011: (Start)
T(1,k) = k^2 (A000290).
T(n,n) = n^2-n+1 (A002061).
T(n,1) = (n-1)^2+1 (A002522). (End)
EXAMPLE
Northwest corner:
.1 4 9 16 .. => a(1) = 1
.2 3 8 15 .. => a(2) = 4, a(3) = 2
.5 6 7 14 .. => a(4) = 9, a(5) = 3, a(6) = 5
10 11 12 13 .. => a(7) = 16, a(8) = 8, a(9) = 6, a(10)=10
MAPLE
T:= (n, k)-> `if`(n<=k, k^2-n+1, (n-1)^2+k):
seq(seq(T(n, d-n), n=1..d-1), d=2..15);
MATHEMATICA
f[n_, k_]:=k^2-n+1/; k>=n;
f[n_, k_]:=(n-1)^2+k/; k<n;
TableForm[Table[f[n, k], {n, 1, 10}, {k, 1, 15}]]
Table[f[n-k+1, k], {n, 14}, {k, n, 1, -1}]//Flatten (* Clark Kimberling, Feb 01 2011 *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Frank Ellermann, Apr 23 2001
EXTENSIONS
Corrected by Jeremy Gardiner, Dec 26 2008
STATUS
approved