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!)
A208234 Second inverse function (numbers of columns) for pairing function A188568. 2
1, 2, 1, 1, 2, 3, 4, 2, 3, 1, 1, 4, 3, 2, 5, 6, 2, 4, 3, 5, 1, 1, 6, 3, 4, 5, 2, 7, 8, 2, 6, 4, 5, 3, 7, 1, 1, 8, 3, 6, 5, 4, 7, 2, 9, 10, 2, 8, 4, 6, 5, 7, 3, 9, 1, 1, 10, 3, 8, 5, 6, 7, 4, 9, 2, 11 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
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;
2,1;
1,2,3;
4,2,3,1;
1,4,3,2,5;
6,2,4,3,5,1;
1,6,3,4,5,2,7;
...
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: A374412 A363148 A054482 * A092543 A277083 A216222
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 15 18:36 EDT 2024. Contains 375954 sequences. (Running on oeis4.)