The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A188568 Enumeration table T(n,k) by descending antidiagonals. The order of the list - if n is odd: T(n,1), T(2,n-1), T(n-2,3), ..., T(n-1,2), T(1,n); if n is even: T(1,n), T(n-1,2), T(3,n-2), ..., T(2,n-1), T(n,1). 7
1, 2, 3, 6, 5, 4, 7, 9, 8, 10, 15, 12, 13, 14, 11, 16, 20, 18, 19, 17, 21, 28, 23, 26, 25, 24, 27, 22, 29, 35, 31, 33, 32, 34, 30, 36, 45, 38, 43, 40, 41, 42, 39, 44, 37, 46, 54, 48, 52, 50, 51, 49, 53, 47, 55 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Self-inverse permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). This table read layer by layer clockwise is A194280. This table read by boustrophedonic ("ox-plowing") method - layer clockwise, layer counterclockwise and so on - is A064790. - Boris Putievskiy, Mar 14 2013
LINKS
Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
Eric W. Weisstein, MathWorld: Pairing functions
FORMULA
a(n) = ((i+j-1)*(i+j-2)+((-1)^max(i,j)+1)*i-((-1)^max(i,j)-1)*j)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor[(-1+sqrt(8*n-7))/2].
EXAMPLE
The start of the sequence as table:
1, 2, 6, 7, 15, 16, 28, ...
3, 5, 9, 12, 20, 23, 35, ...
4, 8, 13, 18, 26, 31, 43, ...
10, 14, 19, 25, 33, 40, 52, ...
11, 17, 24, 32, 41, 50, 62, ...
21, 27, 34, 42, 51, 61, 73, ...
22, 30, 39, 49, 60, 72, 85, ...
...
The start of the sequence as triangular array read by rows:
1;
2, 3;
6, 5, 4;
7, 9, 8, 10;
15, 12, 13, 14, 11;
16, 20, 18, 19, 17, 21;
28, 23, 26, 25, 24, 27, 22;
...
Row number k contains permutation of the k numbers:
{ (k^2-k+2)/2, (k^2-k+2)/2 + 1, ..., (k^2+k-2)/2 + 1 }.
MATHEMATICA
a[n_] := Module[{t, i, j},
t = Floor[(Sqrt[8n-7]-1)/2];
i = n-t(t+1)/2;
j = (t^2+3t+4)/2-n;
((i+j-1)(i+j-2) + ((-1)^Max[i, j]+1)i - ((-1)^Max[i, j]-1)j)/2];
Array[a, 55] (* Jean-François Alcover, Jan 26 2019 *)
PROG
(Python)
t=int((math.sqrt(8*n-7) - 1)/ 2)
i=n-t*(t+1)/2
j=(t*t+3*t+4)/2-n
m=((i+j-1)*(i+j-2)+((-1)**max(i, j)+1)*i-((-1)**max(i, j)-1)*j)/2
CROSSREFS
Sequence in context: A089852 A122308 A122307 * A354224 A305418 A284459
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Dec 27 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 11 19:50 EDT 2024. Contains 373317 sequences. (Running on oeis4.)