login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A208233 First inverse function (numbers of rows) for pairing function A188568. 2
1, 1, 2, 3, 2, 1, 1, 3, 2, 4, 5, 2, 3, 4, 1, 1, 5, 3, 4, 2, 6, 7, 2, 5, 4, 3, 6, 1, 1, 7, 3, 5, 4, 6, 2, 8, 9, 2, 7, 4, 5, 6, 3, 8, 1, 1, 9, 3, 7, 5, 6, 4, 8, 2, 10, 11, 2, 9, 4, 7, 6, 5, 8, 3, 10, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

LINKS

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

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

FORMULA

a(n) =  max(i,j)*((-1)^i+1)/2-min(i,j)*((-1)^i-1)/2, if i>=j

a(n) = -max(i,j)*((-1)^j-1)/2+min(i,j)*((-1)^j+1)/2, if i<j,

where

t = floor((-1+sqrt(8*n-7))/2),

i = n-t*(t+1)/2,

j = (t*t+3*t+4)/2-n.

EXAMPLE

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

1;

1,2;

3,2,1;

1,3,2,4;

5,2,3,41;

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

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

. . .

Row number k contains permutation numbers form 1 to k.

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

if i>=j:

   result= max(i, j)*((-1)**i+1)/2-min(i, j)*((-1)**i-1)/2

else:

   result=-max(i, j)*((-1)**j-1)/2+min(i, j)*((-1)**j+1)/2

CROSSREFS

Cf. A188568.

Sequence in context: A321305 A026552 A333271 * A176270 A086437 A027907

Adjacent sequences:  A208230 A208231 A208232 * A208234 A208235 A208236

KEYWORD

nonn

AUTHOR

Boris Putievskiy, Jan 10 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 August 9 10:38 EDT 2020. Contains 336323 sequences. (Running on oeis4.)