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!)
A213196 Inverse permutation of A211377. 3
1, 4, 2, 3, 5, 6, 11, 7, 8, 12, 13, 9, 10, 14, 15, 22, 16, 17, 23, 24, 18, 19, 25, 26, 20, 21, 27, 28, 37, 29, 30, 38, 39, 31, 32, 40, 41, 33, 34, 42, 43, 35, 36, 44, 45, 56, 46, 47, 57, 58, 48, 49, 59, 60, 50, 51, 61, 62, 52, 53, 63, 64, 54, 55, 65, 66, 79 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
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
a(n)=(m1+m2-1)*(m1+m2-2)/2+m1, where
m1=(3*i+j-1-(-1)^i+(i+j-2)*(-1)*t)/4,
m2=((1+(-1)^i)*((1+(-1)^j)*2*int((j+2)/4)-(-1+(-1)^j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)^i)*((1+(-1)^j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)^j)*(1+2*int(j/4))))/4,
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 triangle array read by rows:
1;
4,2;
3,5,6;
11,7,8,12;
13,9,10,14,15;
22,16,17,23,24,18;
19,25,26,20,21,27,28;
. . .
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of above triangle array.
Last 2*r-1 numbers are from the row number 2*r-1 of above triangle array.
1;
4,2,3,5,6;
11,7,8,12,13,9,10,14,15;
22,16,17,23,24,18,19,25,26,20,21,27,28;
Row number r contains permutation of 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r: 2*r*r-3*r+2, 2*r*r-5*r+4, 2*r*r-5*r+5,... 2*r*r-r-1, 2*r*r-r.
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
m1=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4
m2=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4
result=(m1+m2-1)*(m1+m2-2)/2+m1
CROSSREFS
Cf. A211377.
Sequence in context: A182272 A182273 A166016 * A275104 A010646 A284307
KEYWORD
nonn
AUTHOR
Boris Putievskiy, Mar 01 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 June 12 21:26 EDT 2024. Contains 373360 sequences. (Running on oeis4.)