login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A213195 Second inverse function (of columns) for pairing function A211377. 1
1, 3, 2, 1, 2, 1, 5, 4, 3, 4, 3, 2, 1, 2, 1, 7, 6, 5, 6, 5, 4, 3, 4, 3, 2, 1, 2, 1, 9, 8, 7, 8, 7, 6, 5, 6, 5, 4, 3, 4, 3, 2, 1, 2, 1, 11, 10, 9, 10, 9, 8, 7, 8, 7, 6, 5, 6, 5, 4, 3, 4, 3, 2, 1, 2, 1, 13, 12, 11, 12, 11, 10, 9, 10, 9, 8, 7, 8, 7, 6, 5, 6, 5, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

LINKS

Boris Putievskiy, Rows n = 1..140 of triangle, flattened

Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO]

Eric W. Weisstein, MathWorld: Pairing functions

Index entries for sequences that are permutations of the natural numbers

FORMULA

a(n)=((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.

EXAMPLE

The start of the sequence as triangle array read by rows:

1;

3,2;

1,2,1;

5,4,3,4;

3,2,1,2,1;

7,6,5,6,5,4;

3,4,3,2,1,2,1;

. . .

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 triangle array, located above.

Last  2*r-1 numbers are from the row number 2*r-1 of triangle array, located above.

1;

3,2,1,2,1;

5,4,3,4,3,2,1,2,1;

7,6,5,6,5,4,3,4,3,2,1,2,1;

...

Row number r is 2*r-1, 2*r-2, 2*r-3, 2*r-2, {row number r-1}.

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

result=((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

CROSSREFS

Cf. A211377.

Sequence in context: A096248 A079109 A079099 * A256794 A068929 A060567

Adjacent sequences:  A213192 A213193 A213194 * A213196 A213197 A213198

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 19 03:27 EST 2019. Contains 329310 sequences. (Running on oeis4.)