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!)
A214928 A209293 as table read layer by layer clockwise. 2
1, 2, 4, 3, 5, 9, 14, 7, 6, 8, 12, 17, 23, 20, 11, 10, 13, 19, 26, 34, 43, 30, 27, 16, 15, 18, 24, 31, 39, 48, 58, 53, 38, 35, 22, 21, 25, 33, 42, 52, 63, 75, 88, 69, 64, 47, 44, 29, 28, 32, 40, 49, 59, 70, 82, 95, 109, 102, 81, 76, 57, 54, 37, 36, 41, 51, 62 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
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.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). The order of the list:
T(1,1)=1;
T(1,2), T(2,2), T(2,1);
. . .
T(1,n), T(2,n), ... T(n-1,n), T(n,n), T(n,n-1), ... T(n,1);
. . .
LINKS
Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
Eric Weisstein's World of Mathematics, Pairing functions
FORMULA
As table
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n)= (m1+m2-1)*(m1+m2-2)/2+m1, where m1=floor((i+j)/2) + floor(i/2)*(-1)^(2*i+j-1), m2=int((i+j+1)/2)+int(i/2)*(-1)^(2*i+j-2), where i=min(t; n-(t-1)^2), j=min(t; t^2-n+1), t=floor(sqrt(n-1))+1.
EXAMPLE
The start of the sequence as table:
1....2...5...8..13..18...
3....4...9..12..19..24...
6....7..14..17..26..31...
10..11..20..23..34..39...
15..16..27..30..43..48...
21..22..35..38..53..58...
. . .
The start of the sequence as triangle array read by rows:
1;
2,4,3;
5,9,14,7,6;
8,12,17,23,20,11,10;
13,19,26,34,43,30,27,16,15;
18,24,31,39,48,58,53,38,35,22,21;
. . .
Row number r contains 2*r-1 numbers.
PROG
(Python)
t=int((math.sqrt(n-1)))+1
i=min(t, n-(t-1)**2)
j=min(t, t**2-n+1)
m1=int((i+j)/2)+int(i/2)*(-1)**(2*i+j-1)
m2=int((i+j+1)/2)+int(i/2)*(-1)**(2*i+j-2)
result=(m1+m2-1)*(m1+m2-2)/2+m1
CROSSREFS
Sequence in context: A082330 A082329 A072799 * A240277 A091449 A100834
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Mar 11 2013
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 August 11 23:45 EDT 2024. Contains 375082 sequences. (Running on oeis4.)